/* AgentDuo website. One stylesheet, no framework. Tokens first; the two agent colours carry meaning (teal: Codex,
   orange: Claude Code) and are not used for decoration. See website/DESIGN.md. */

/* Be Vietnam Pro (SIL Open Font License, assets/fonts/OFL.txt), served from this site. Each style is split into the
   Latin, Latin Extended and Vietnamese subsets, so a page downloads only the ones its text uses. */
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/be-vietnam-pro-vietnamese-400-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/be-vietnam-pro-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/be-vietnam-pro-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/be-vietnam-pro-vietnamese-400-italic.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/be-vietnam-pro-latin-ext-400-italic.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/be-vietnam-pro-latin-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/be-vietnam-pro-vietnamese-500-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/be-vietnam-pro-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/be-vietnam-pro-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/be-vietnam-pro-vietnamese-600-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/be-vietnam-pro-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/be-vietnam-pro-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/be-vietnam-pro-vietnamese-700-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/be-vietnam-pro-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/be-vietnam-pro-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Cool ink neutrals, so the two agent colours are the only hues on the page. Text sits at 7:1 or more, borders that
   mark a control at about 3:1, and the dark theme separates its layers with borders and a deeper code well. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #e9eef3;
  --text: #111a24;
  --heading: #0b131c;
  --muted: #46525f;
  --line: #d3dae3;
  --line-strong: #a7b2bf;
  --control-line: #8b97a5;
  --link: #0a6a5f;
  --teal: #0b7a6e;
  --teal-hover: #08645a;
  --orange: #ad4a17;
  --mark-teal: #14a892;
  --mark-orange: #e0832f;
  --gates: #6b7785;
  --focus: #ad4a17;
  --code-bg: #142030;
  --code-text: #e4ebf2;
  --code-line: transparent;
  --mark-bg: #ffe3a3;
  --warn-bg: #fdf0e4;
  --warn-line: #e0832f;
  --note-bg: #e4f3f0;
  --note-line: #14a892;
  --teal-soft: color-mix(in srgb, var(--mark-teal) 13%, var(--surface));
  --orange-soft: color-mix(in srgb, var(--mark-orange) 15%, var(--surface));
  /* The page's texture: a dot grid and a light from the top, both fading out before the reading text. */
  --texture-dot: rgb(17 26 36 / 0.11);
  --texture-glow: rgb(255 255 255 / 0.95);
  --edge: 0 0 #0000;
  --elevation: 0 1px 2px rgb(16 24 40 / 0.05), 0 18px 40px -22px rgb(16 24 40 / 0.28);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius-large: 18px;
  --radius: 12px;
  --radius-small: 8px;
  --header-h: 4rem;
  --control-h: 2.375rem;
  --measure: 42rem;
  --page: 84rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1118;
    --surface: #141d27;
    --surface-2: #1c2733;
    --text: #eef3f8;
    --heading: #f7fafc;
    --muted: #b3bfcb;
    --line: #2e3b4a;
    --line-strong: #46566a;
  --control-line: #5a6b7f;
    --link: #63dcc9;
    --teal: #0e7f71;
    --teal-hover: #0b6c60;
    --orange: #f5ab6a;
    --gates: #98a6b5;
    --focus: #f5ab6a;
    --code-bg: #060a0f;
    --code-text: #e8eef4;
    --code-line: #2a3747;
    --mark-bg: #5e4512;
    --warn-bg: #2b2119;
    --note-bg: #10302b;
    --teal-soft: color-mix(in srgb, var(--mark-teal) 20%, var(--surface));
    --orange-soft: color-mix(in srgb, var(--mark-orange) 22%, var(--surface));
    --texture-dot: rgb(214 226 240 / 0.14);
    --texture-glow: rgb(110 145 190 / 0.16);
    --edge: inset 0 1px 0 rgb(255 255 255 / 0.06);
    --elevation: 0 24px 48px -24px rgb(0 0 0 / 0.75);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1118;
  --surface: #141d27;
  --surface-2: #1c2733;
  --text: #eef3f8;
  --heading: #f7fafc;
  --muted: #b3bfcb;
  --line: #2e3b4a;
  --line-strong: #46566a;
  --control-line: #5a6b7f;
  --link: #63dcc9;
  --teal: #0e7f71;
  --teal-hover: #0b6c60;
  --orange: #f5ab6a;
  --gates: #98a6b5;
  --focus: #f5ab6a;
  --code-bg: #060a0f;
  --code-text: #e8eef4;
  --code-line: #2a3747;
  --mark-bg: #5e4512;
  --warn-bg: #2b2119;
  --note-bg: #10302b;
  --teal-soft: color-mix(in srgb, var(--mark-teal) 20%, var(--surface));
  --orange-soft: color-mix(in srgb, var(--mark-orange) 22%, var(--surface));
  --texture-dot: rgb(214 226 240 / 0.14);
  --texture-glow: rgb(110 145 190 / 0.16);
  --edge: inset 0 1px 0 rgb(255 255 255 / 0.06);
  --elevation: 0 24px 48px -24px rgb(0 0 0 / 0.75);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  padding-top: var(--header-h);
  background: var(--bg);
  color: var(--text);
  font: 400 1.03125rem/1.7 var(--font);
  overflow-wrap: break-word;
}

/* Under the header and the top of the page only: it scrolls away with them and fades out before the text below.
   The home page's covers its hero; elsewhere it stops above the first section. */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--texture-h, 26rem);
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle, var(--texture-dot) 1px, transparent 1.6px) 0 0 / 22px 22px,
    radial-gradient(ellipse 75% 85% at 50% 0%, var(--texture-glow), transparent 72%);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}

.layout-home {
  --texture-h: 58rem;
}

@media (prefers-contrast: more), (forced-colors: active) {
  body::before {
    display: none;
  }
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

main:focus {
  outline: none;
}

img,
svg {
  max-width: 100%;
}

strong,
b {
  font-weight: 600;
}

/* A major-third scale on a 16.5px body; headings are set tighter than the text, never heavier than 700. */
h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.25;
  letter-spacing: -0.012em;
  font-weight: 600;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.05rem, 1.6rem + 1.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.028em;
}

h2 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin-top: 2.6rem;
}

h3 {
  font-size: 1.22rem;
  margin-top: 2rem;
}

h4 {
  font-size: 1.03125rem;
  margin-top: 1.5rem;
}

:lang(vi) :is(h1, h2, h3) {
  line-height: 1.3;
}

p,
ul,
ol,
dl {
  margin: 0 0 1.05em;
}

li + li {
  margin-top: 0.35em;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

:not(pre) > code {
  background: var(--surface-2);
  border-radius: 5px;
  padding: 0.12em 0.38em;
  overflow-wrap: anywhere;
}

kbd {
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 0.35em;
  background: var(--surface);
  font-size: 0.8em;
}

mark {
  background: var(--mark-bg);
  color: inherit;
  border-radius: 3px;
  padding: 0 0.1em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--surface);
  color: var(--text);
  padding: 0.6rem 1rem;
  border: 2px solid var(--focus);
  border-radius: var(--radius-small);
}

.skip-link:focus {
  top: 0.75rem;
}

/* ------------------------------------------------------------------ header */

/* Fixed, not sticky: with the page's scroll-padding, a sticky header's search box sits inside the padded area, so
   the browser scrolls the page up at every key to bring the caret "into view". A fixed box is never scrolled to. */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--page);
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.025em;
  flex: none;
}

.logo {
  width: 1.7rem;
  height: 1.7rem;
}

.logo-codex {
  stroke: var(--mark-teal);
}

.logo-claude {
  stroke: var(--mark-orange);
}

.logo-codex-dot {
  fill: var(--mark-teal);
}

.logo-claude-dot {
  fill: var(--mark-orange);
}

.primary-nav {
  flex: 1;
}

.nav-list {
  display: flex;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li + li {
  margin-top: 0;
}

.nav-list a {
  position: relative;
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-small);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.97rem;
}

.nav-list a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-list a[aria-current="page"],
.nav-list a.is-active {
  color: var(--text);
}

/* The current section is marked on the header's bottom edge. */
.nav-list a[aria-current="page"]::after,
.nav-list a.is-active::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc((var(--header-h) - 2.4rem) / -2 - 1px);
  height: 2px;
  border-radius: 2px;
  background: var(--mark-teal);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

/* The header's search box and theme menu share one height, type size and border, so they line up side by side. */
.search-input,
.theme-select {
  box-sizing: border-box;
  height: var(--control-h);
  margin: 0;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: var(--radius-small);
}

.search-input:hover,
.theme-select:hover {
  border-color: var(--muted);
}

.search-input {
  width: 13.5rem;
  padding: 0 3.2rem 0 0.75rem;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-shortcut {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  height: 1.5rem;
  min-width: 1.9rem;
  display: inline-grid;
  place-items: center;
  padding: 0 0.3rem;
  border-bottom-width: 1px;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
}

.search-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.search-submit:focus-visible {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
  margin-left: 0.4rem;
}

.lang-link,
.github-link {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

.lang-link:hover,
.github-link:hover {
  color: var(--text);
  text-decoration: underline;
}

/* The menu draws its own chevron (on .theme-control) instead of the browser's, which differs by platform. */
.theme-control {
  position: relative;
  display: inline-flex;
}

.theme-control::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.8rem;
  width: 0.38rem;
  height: 0.38rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.theme-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 2.1rem 0 0.75rem;
  cursor: pointer;
}

.mobile-menu {
  display: none;
  margin-left: auto;
}

.mobile-menu-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-small);
  font-weight: 500;
  background: var(--surface);
}

.mobile-menu-button::-webkit-details-marker {
  display: none;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-icon::before {
  top: -5px;
}

.menu-icon::after {
  top: 5px;
}

.mobile-menu[open] .menu-icon {
  background: transparent;
}

.mobile-menu[open] .menu-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu[open] .menu-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.mobile-menu-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.25rem 1.5rem;
  box-shadow: 0 16px 32px -20px rgb(10 20 30 / 0.4);
}

.mobile-menu-panel .search-form {
  margin-bottom: 0.75rem;
}

.mobile-menu-panel .search-input,
.mobile-menu-panel .search-trigger {
  width: 100%;
}

.mobile-menu-panel .search-trigger {
  margin-bottom: 0.75rem;
}

/* ------------------------------------------------------------------ search dialog */

/* The button that opens the dialog looks like the search box it replaces. */
.search-trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: 13.5rem;
  height: var(--control-h);
  margin: 0;
  padding: 0 0.45rem 0 0.7rem;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.2;
  text-align: left;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.search-trigger:hover {
  color: var(--text);
  border-color: var(--muted);
}

.search-icon {
  flex: none;
  width: 1rem;
  height: 1rem;
}

.search-trigger-label {
  flex: 1;
}

.search-trigger .search-shortcut {
  position: static;
  transform: none;
}

/* While the dialog is open the page under it does not scroll; the gutter keeps the layout from shifting. */
html.has-dialog {
  overflow: hidden;
  scrollbar-gutter: stable;
}

/* The panel sets the height; the browser's own limits for a modal dialog would cut its footer off on a phone. */
.search-dialog {
  width: min(40rem, calc(100vw - 2rem));
  max-width: none;
  max-height: none;
  margin: min(12vh, 6rem) auto auto;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  box-shadow: var(--edge), 0 32px 80px -24px rgb(6 12 20 / 0.55);
  overflow: hidden;
}

.search-dialog::backdrop {
  background: rgb(6 10 16 / 0.5);
  backdrop-filter: blur(2px);
}

.search-dialog-panel {
  display: flex;
  flex-direction: column;
  max-height: min(34rem, calc(100vh - 8rem));
}

.search-dialog-form {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.75rem 0 1.1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.search-dialog-form .search-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.search-dialog-input {
  flex: 1;
  min-width: 0;
  height: 3.6rem;
  padding: 0;
  font: inherit;
  font-size: 1.08rem;
  color: var(--text);
  background: transparent;
  border: 0;
}

.search-dialog-input:focus,
.search-dialog-input:focus-visible {
  outline: none;
}

.search-dialog-input::placeholder {
  color: var(--muted);
}

.search-dialog-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-dialog-close {
  flex: none;
  font: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0.25rem;
  cursor: pointer;
}

.search-dialog-close span {
  display: none;
}

.search-dialog-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.4rem 0.5rem;
}

.search-dialog-body:has(.search-dialog-options:empty):has(.search-dialog-status.visually-hidden) {
  padding: 0;
}

.search-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.35rem 0.6rem 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.search-dialog-clear {
  font: inherit;
  color: var(--link);
  background: none;
  border: 0;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
}

.search-dialog-options {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-dialog-option {
  margin: 0;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.search-dialog-option + .search-dialog-option {
  margin-top: 2px;
}

.search-dialog-option[aria-selected="true"] {
  background: var(--teal-soft);
}

.search-dialog-option a {
  display: block;
  padding: 0.6rem 0.75rem;
  color: inherit;
  text-decoration: none;
}

.search-dialog-option.is-recent {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.search-dialog-title {
  display: block;
  font-size: 0.95rem;
  line-height: 1.4;
}

.search-dialog-page {
  color: var(--muted);
}

.search-dialog-option[aria-selected="true"] strong {
  color: var(--link);
}

.search-dialog-snippet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 0.15rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
}

.search-dialog-status {
  margin: 0;
  padding: 1.1rem 0.75rem;
  font-size: 0.93rem;
  color: var(--muted);
}

.search-dialog-footer {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.8rem;
  color: var(--muted);
}

.search-dialog-all {
  font-weight: 600;
}

.search-dialog-keys {
  display: flex;
  gap: 1rem;
  margin: 0 0 0 auto;
}

.search-dialog-keys kbd + kbd {
  margin-left: 0.2rem;
}

/* Opening answers the key or the click with a short drop-in; closing is instant. */
@media (prefers-reduced-motion: no-preference) {
  .search-dialog[open] {
    animation: search-dialog-in 0.16s ease-out;
  }
}

@keyframes search-dialog-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
}

@media (max-width: 639px), (pointer: coarse) {
  .search-dialog-keys {
    display: none;
  }

  /* Without the key hints, a footer with no "see all" link would be an empty strip. */
  .search-dialog-footer:has(> .search-dialog-all[hidden]) {
    display: none;
  }
}

@media (max-width: 639px) {
  .search-dialog {
    width: calc(100vw - 1rem);
    margin-top: 0.5rem;
  }

  .search-dialog-panel {
    max-height: calc(100dvh - 1rem);
  }

  .search-dialog-close kbd {
    display: none;
  }

  .search-dialog-close span {
    display: inline;
    font-size: 0.95rem;
    color: var(--link);
  }
}

.mobile-nav-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.mobile-nav-list li + li {
  margin-top: 0;
  border-top: 1px solid var(--line);
}

.mobile-nav-list a {
  display: block;
  padding: 0.75rem 0.25rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
}

.mobile-nav-list a[aria-current="page"],
.mobile-nav-list a.is-active {
  color: var(--link);
  font-weight: 600;
}

.mobile-menu-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 1099px) {
  .primary-nav,
  .header-tools {
    display: none;
  }

  .mobile-menu {
    display: block;
  }
}

/* ------------------------------------------------------------------ buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-small);
  border: 1px solid var(--control-line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  line-height: 1.3;
}

.button:hover {
  border-color: var(--text);
}

.button-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--teal-hover);
  border-color: var(--teal-hover);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 1rem;
}

/* ------------------------------------------------------------------ home */

/* The headline and its explanation share the first row; the pipeline runs the full width under them. */
.hero {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.5rem, 5.5vw, 4.75rem) 1.25rem clamp(2.5rem, 5vw, 4.5rem);
}

.hero-text {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem clamp(2rem, 5vw, 5rem);
  align-items: end;
  margin-bottom: clamp(2.25rem, 5vw, 4rem);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 1.3rem + 3.9vw, 4.35rem);
  line-height: 1.04;
  letter-spacing: -0.042em;
}

.hero h1:lang(vi) {
  line-height: 1.16;
}

.hero-side .lead p {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 34rem;
}

.hero-side .actions {
  margin-top: 1.5rem;
}

.hero-meta {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 34rem;
  margin: 0;
}

.band {
  border-top: 1px solid var(--line);
}

/* A section's heading sits in its own column beside the text; wide sections put it on top. */
.band-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
  gap: 1.25rem clamp(2rem, 5vw, 5rem);
}

.band-wide .band-inner {
  grid-template-columns: minmax(0, 1fr);
}

.band h2 {
  margin: 0;
  font-size: clamp(1.6rem, 1.25rem + 1vw, 2.15rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  max-width: 20ch;
}

.band-wide h2 {
  max-width: 30ch;
}

.band-body {
  min-width: 0;
}

.band-body > :last-child {
  margin-bottom: 0;
}

.band .band-lead {
  color: var(--muted);
  font-size: 1.125rem;
  max-width: 44rem;
  margin-bottom: 1.75rem;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 3rem;
}

.benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 3rem;
  color: var(--muted);
}

.benefits li {
  margin: 0;
  padding: 1.25rem 0 1.4rem;
  border-top: 1px solid var(--line);
}

.benefits strong {
  display: block;
  color: var(--text);
  font-size: 1.08rem;
  margin-bottom: 0.3rem;
}

.interfaces {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--edge);
}

.interface {
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.75rem 1.5rem;
}

.interface + .interface {
  border-left: 1px solid var(--line);
}

.interface h3 {
  margin-top: 0;
  font-size: 1.25rem;
}

.interface .needs {
  color: var(--muted);
  font-size: 0.92rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line-strong);
}

/* The links line up at the bottom whatever the length of the text above them. */
.interface > p:last-child {
  margin: auto 0 0;
  font-weight: 600;
}

/* The pipeline figure: two stages, each a track of numbered steps with the way back drawn under it. On wide screens
   the stages sit side by side and the handoff is the arrow between them. */
.flow {
  --dot-size: 2.6rem;
  position: relative;
  isolation: isolate;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  box-shadow: var(--edge), var(--elevation);
}

.flow-stage {
  min-width: 0;
}

.flow-stage-title {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
}

.flow-steps {
  counter-reset: flow-step;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
}

.flow-build .flow-steps {
  counter-reset: flow-step 3;
}

.flow-steps::before {
  content: "";
  position: absolute;
  top: calc(var(--dot-size) / 2 - 1px);
  left: 16.67%;
  right: 16.67%;
  height: 2px;
  background: var(--line-strong);
}

.flow-step {
  counter-increment: flow-step;
  position: relative;
  text-align: center;
  margin: 0;
  padding: 0 0.25rem;
}

.flow-step + .flow-step {
  margin-top: 0;
}

.flow-step::before {
  content: counter(flow-step);
  position: relative;
  display: grid;
  place-items: center;
  width: var(--dot-size);
  height: var(--dot-size);
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--dot, var(--gates)) 15%, var(--surface));
  border: 2.5px solid var(--dot, var(--gates));
  box-shadow: 0 0 0 5px var(--surface);
  color: var(--dot-ink, var(--muted));
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  z-index: 2;
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}

.flow-step + .flow-step::after {
  content: "";
  position: absolute;
  top: calc(var(--dot-size) / 2 - 0.32rem);
  left: -0.3rem;
  border: 0.32rem solid transparent;
  border-left: 0.45rem solid var(--line-strong);
}

.agent-codex {
  --dot: var(--mark-teal);
  --dot-ink: var(--link);
}

.agent-claude {
  --dot: var(--mark-orange);
  --dot-ink: var(--orange);
}

.agent-gates::before {
  background: var(--surface) !important;
  border: 2.5px dashed var(--gates) !important;
}

.flow-name {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.35;
}

.flow-who {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

/* The way back runs from the step that sends work back to the step that gets it; its label sits under the line. */
.flow-back {
  position: relative;
  margin: 0.75rem 16.67% 1.6rem;
  height: 1.3rem;
  border: 1.5px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
}

.flow-back span {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.flow-plan .flow-back {
  margin-right: 50%;
}

.flow-back::before {
  content: "";
  position: absolute;
  left: -0.4rem;
  top: -0.55rem;
  border: 0.34rem solid transparent;
  border-bottom: 0.5rem solid var(--line-strong);
  border-top: 0;
}

.flow-handoff {
  margin: 0;
  padding: 1.25rem 0 1rem;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
}

.flow-handoff::before {
  content: "";
  display: block;
  width: 2px;
  height: 1rem;
  margin: 0 auto 0.4rem;
  background: var(--line-strong);
}

.flow-done {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}

.flow figcaption {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-legend li {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.flow-legend li::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--dot, transparent);
}

.flow-legend .agent-gates::before {
  border: 2px dashed var(--gates);
}

/* The work in progress (site.js): a dot that runs the steps in a run's order. It passes under each step's circle,
   which lights while that step works, and over the lines between them. */
.flow-token {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 0.7rem;
  height: 0.7rem;
  margin: -0.35rem 0 0 -0.35rem;
  border-radius: 50%;
  background: var(--dot, var(--gates));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--dot, var(--gates)) 28%, transparent),
    0 0 14px 3px color-mix(in srgb, var(--dot, var(--gates)) 50%, transparent);
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.flow-step.is-active::before {
  background: color-mix(in srgb, var(--dot, var(--gates)) 30%, var(--surface));
  box-shadow:
    0 0 0 5px var(--surface),
    0 0 0 7.5px color-mix(in srgb, var(--dot, var(--gates)) 45%, transparent),
    0 0 26px 8px color-mix(in srgb, var(--dot, var(--gates)) 32%, transparent);
}

.flow-back,
.flow-back::before,
.flow-handoff,
.flow-handoff::before,
.flow-done {
  transition: color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease;
}

.flow-back.is-active,
.flow-handoff.is-active {
  color: var(--text);
}

.flow-back.is-active {
  border-color: var(--muted);
}

.flow-back.is-active::before {
  border-bottom-color: var(--muted);
}

.flow-handoff.is-active::before {
  background-color: var(--muted);
}

.flow-done.is-active {
  box-shadow: inset 0 0 0 1.5px var(--gates);
}

.flow-motion {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.flow-motion:hover {
  color: var(--text);
  border-color: var(--control-line);
}

.flow-motion:focus-visible {
  border-radius: 50%;
}

/* Two bars while it runs; a triangle once paused. */
.flow-motion::before {
  content: "";
  box-sizing: border-box;
  width: 0.6rem;
  height: 0.7rem;
  border-left: 2.5px solid currentColor;
  border-right: 2.5px solid currentColor;
}

.flow-motion[data-paused]::before {
  width: 0;
  height: 0;
  margin-left: 0.15rem;
  border-style: solid;
  border-width: 0.38rem 0 0.38rem 0.62rem;
  border-color: transparent transparent transparent currentColor;
}

@media (min-width: 1100px) {
  .flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 9.5rem minmax(0, 1fr);
    align-items: start;
  }

  .flow-plan {
    grid-column: 1;
    grid-row: 1;
  }

  .flow-build {
    grid-column: 3;
    grid-row: 1;
  }

  /* The handoff lines up with the tracks: below the stage title, at the centre of the steps. */
  .flow-handoff {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    padding: calc(1.3rem + 1rem + var(--dot-size) / 2 + 0.7rem) 0.5rem 0;
  }

  .flow-handoff::before {
    position: absolute;
    top: calc(1.3rem + 1rem + var(--dot-size) / 2 - 1px);
    left: 0;
    right: 0.45rem;
    width: auto;
    height: 2px;
    margin: 0;
    background: repeating-linear-gradient(to right, var(--line-strong) 0 6px, transparent 6px 11px);
  }

  .flow-handoff::after {
    content: "";
    position: absolute;
    top: calc(1.3rem + 1rem + var(--dot-size) / 2 - 0.36rem);
    right: 0;
    border: 0.36rem solid transparent;
    border-left: 0.5rem solid var(--line-strong);
    border-right: 0;
  }

  .flow-handoff.is-active::before {
    background: repeating-linear-gradient(to right, var(--muted) 0 6px, transparent 6px 11px);
  }

  .flow-handoff.is-active::after {
    border-left-color: var(--muted);
  }

  .flow-done,
  .flow figcaption {
    grid-column: 1 / -1;
  }
}

/* The steps light up in the order a run takes them; then the dot (site.js) starts. */
@media (prefers-reduced-motion: no-preference) {
  .flow-step::before {
    animation: flow-step-in 0.45s cubic-bezier(0.2, 0.7, 0.3, 1.2) both;
    animation-delay: calc(0.15s + var(--i, 0) * 0.12s);
  }

  .flow-steps::before {
    animation: flow-track-in 0.5s ease-out both;
    transform-origin: left center;
  }

  .flow-build .flow-steps::before {
    animation-delay: 0.45s;
  }

  .flow-plan .flow-step:nth-child(2),
  .flow-build .flow-step:nth-child(2) {
    --i: 1;
  }

  .flow-plan .flow-step:nth-child(3),
  .flow-build .flow-step:nth-child(3) {
    --i: 2;
  }

  .flow-build .flow-step:nth-child(1) {
    --i: 3;
  }

  .flow-build .flow-step:nth-child(2) {
    --i: 4;
  }

  .flow-build .flow-step:nth-child(3) {
    --i: 5;
  }
}

@keyframes flow-step-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes flow-track-in {
  from {
    transform: scaleX(0);
  }
}

/* ------------------------------------------------------------------ pages and docs */

.page-shell,
.doc-shell {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.page-shell.has-toc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 3.5rem;
}

.page-main {
  min-width: 0;
  max-width: 56rem;
}

.page-shell.has-toc .page-main {
  max-width: none;
}

.page-main > .doc-section,
.page-main > .related,
.page-main > .next-step,
.page-header .lead {
  max-width: var(--measure);
}

.layout-download .page-main > .doc-section,
.layout-page .page-main > .doc-section.wide {
  max-width: none;
}

.doc-shell {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr) 13.5rem;
  grid-template-areas: "nav main toc";
  gap: 3.5rem;
}

.doc-main {
  grid-area: main;
  min-width: 0;
}

.doc {
  max-width: var(--measure);
}

.doc-nav {
  grid-area: nav;
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
  font-size: 0.93rem;
  line-height: 1.45;
  padding-right: 0.5rem;
}

.doc-nav-group + .doc-nav-group {
  margin-top: 1.5rem;
}

.doc-nav-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.4rem;
  padding-left: 0.75rem;
  letter-spacing: 0;
}

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

.doc-nav li + li {
  margin-top: 1px;
}

.doc-nav a {
  display: block;
  padding: 0.36rem 0.75rem;
  border-radius: var(--radius-small);
  color: var(--muted);
  text-decoration: none;
}

.doc-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.doc-nav a[aria-current="page"] {
  color: var(--link);
  font-weight: 600;
  background: var(--teal-soft);
}

.doc-toc {
  grid-area: toc;
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
  font-size: 0.87rem;
  line-height: 1.45;
}

.page-shell .doc-toc {
  grid-area: auto;
}

.toc-title {
  font-weight: 600;
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
}

.doc-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.doc-toc li + li {
  margin-top: 0;
}

.doc-toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0 0.3rem 0.85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
}

.doc-toc a:hover {
  color: var(--text);
}

.doc-toc a.is-current {
  color: var(--link);
  border-left-color: var(--mark-teal);
}

.toc-compact {
  display: none;
  margin: 1.5rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--edge);
}

.toc-compact summary {
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.toc-compact ul {
  margin: 0;
  padding: 0 1rem 0.85rem 2.1rem;
  font-size: 0.95rem;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: 0.87rem;
  color: var(--muted);
}

.breadcrumbs li + li {
  margin-top: 0;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--line-strong);
}

.breadcrumbs a {
  color: var(--muted);
}

.browse-link {
  display: none;
  font-size: 0.93rem;
  margin-bottom: 0.75rem;
}

.doc-header,
.page-header {
  margin-bottom: 2rem;
}

.lead p {
  font-size: 1.17rem;
  line-height: 1.65;
  color: var(--muted);
}

.doc-section {
  margin-top: 2.75rem;
}

.doc-section > h2 {
  margin-top: 0;
}

.heading-link {
  color: inherit;
  text-decoration: none;
}

.heading-link:hover::after,
.heading-link:focus-visible::after {
  content: " #";
  color: var(--line-strong);
  font-weight: 400;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.25rem 2.5rem;
  margin: 0 0 0 0.95rem;
  border-left: 2px solid var(--line);
}

.steps > li:last-child {
  border-left-color: transparent;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -0.95rem;
  top: -0.05rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--teal-soft);
  border: 2px solid var(--mark-teal);
  color: var(--link);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.step-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.defs dt {
  font-weight: 600;
  margin-top: 1.1rem;
}

.defs dd {
  margin: 0.2rem 0 0;
}

.callout {
  border-left: 3px solid var(--note-line);
  background: var(--note-bg);
  padding: 0.95rem 1.15rem 0.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0 0 1.3rem;
}

.callout-warning {
  border-left-color: var(--warn-line);
  background: var(--warn-bg);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

/* Code blocks scroll inside their own box; the copy button is added by site.js. */
.code {
  position: relative;
  margin: 0 0 1.3rem;
}

.code-label {
  margin: 0;
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-family: var(--mono);
  color: color-mix(in srgb, var(--code-text) 78%, var(--code-bg));
  background: color-mix(in srgb, var(--code-bg) 90%, #ffffff);
  border: 1px solid var(--code-line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.code pre {
  margin: 0;
  padding: 1rem 1.15rem;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-line);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.84rem;
  tab-size: 2;
}

.code-label + pre {
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Tokens from lib/highlight.mjs. Code blocks are dark in both themes, so one set serves both; none is teal or orange,
   which stay the agents' colours. The command each line runs is the strongest mark. */
.tk-cmd {
  color: #7cc8ff;
  font-weight: 600;
}

.tk-key {
  color: #7cc8ff;
}

.tk-flag,
.tk-var,
.tk-kw,
.tk-lit {
  color: #c5a8ff;
}

.tk-str,
.tk-add {
  color: #b3d98c;
}

.tk-del {
  color: #ff9e9e;
}

.tk-com,
.tk-punct {
  color: #8294a8;
}

.code.has-copy pre {
  padding-right: 5.5rem;
}

.copy-button {
  position: absolute;
  right: 0.55rem;
  top: 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.18rem 0.6rem;
  color: var(--code-text);
  background: rgb(255 255 255 / 0.07);
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 6px;
  cursor: pointer;
}

.code-label ~ .copy-button {
  top: 0.28rem;
}

.copy-button:hover {
  background: rgb(255 255 255 / 0.15);
}

.copy-button:focus-visible {
  outline-color: var(--mark-orange);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--edge);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
  line-height: 1.55;
}

caption {
  text-align: left;
  font-weight: 600;
  padding: 0.75rem 0.95rem 0.5rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.95rem;
  border-bottom: 1px solid var(--line);
}

thead th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.87rem;
  white-space: nowrap;
}

tbody tr:last-child > * {
  border-bottom: 0;
}

tbody th {
  font-weight: 600;
}

/* A key or command in a table widens its column instead of breaking mid-word; the table scrolls if it must. */
th code,
td code {
  overflow-wrap: break-word;
}

.related,
.next-step {
  margin-top: 3.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.related h2,
.next-step h2 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
  letter-spacing: 0;
}

.related ul {
  columns: 2;
  column-gap: 2rem;
  padding-left: 1.1rem;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.75rem;
}

.pager a {
  display: block;
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  background: var(--surface);
  box-shadow: var(--edge);
}

.pager a:hover {
  border-color: var(--mark-teal);
}

.pager-next {
  text-align: right;
  grid-column: 2;
}

.pager-label {
  display: block;
  font-size: 0.83rem;
  color: var(--muted);
}

.pager-title {
  font-weight: 600;
}

/* ------------------------------------------------------------------ releases */

.release + .release {
  margin-top: 2.5rem;
}

.release-notes {
  margin-top: 1rem;
  padding: 1rem 1.15rem 0.2rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.95rem;
}

.release-notes-title {
  font-weight: 600;
}

/* ------------------------------------------------------------------ download */

.os-picker {
  margin: 0 0 1.75rem;
}

.os-picker-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-small) + 0.25rem);
  background: var(--surface);
  box-shadow: var(--edge);
}

.os-picker-buttons button {
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.45rem 1rem;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.os-picker-buttons button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.os-picker-buttons button[aria-pressed="true"] {
  background: var(--teal-soft);
  color: var(--link);
  font-weight: 600;
}

.os-suggestion {
  color: var(--muted);
  font-size: 0.93rem;
  margin-top: 0.7rem;
}

.os-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--edge);
}

.os-panel > h3 {
  margin-top: 0;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.os-panel .panel-text {
  max-width: var(--measure);
}

.arch-group {
  margin-bottom: 1.25rem;
}

.arch-title {
  margin: 0 0 0.7rem;
}

.installers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.installer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: var(--bg);
  box-shadow: var(--edge);
}

.installer-kind {
  margin: 0 0 0.7rem;
  font-weight: 600;
}

.installer .button {
  width: 100%;
}

.installer-meta {
  margin: 0.7rem 0 0;
  font-size: 0.83rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.installer-file {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.checksum {
  margin-top: 0.5rem;
  font-size: 0.83rem;
}

.checksum summary {
  cursor: pointer;
  color: var(--muted);
}

.checksum code {
  display: block;
  margin-top: 0.4rem;
  word-break: break-all;
}

.unavailable {
  color: var(--muted);
  font-size: 0.93rem;
  border-left: 3px solid var(--line-strong);
  padding-left: 0.85rem;
}

.channels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--edge);
}

.channel {
  padding: 1.15rem 1.35rem;
}

.channel + .channel {
  border-left: 1px solid var(--line);
}

.channel h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0;
}

.channel .version {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

.channel .meta {
  color: var(--muted);
  font-size: 0.87rem;
  margin: 0;
}

/* ------------------------------------------------------------------ search */

.search-page-form {
  display: flex;
  gap: 0.5rem;
  max-width: 40rem;
  margin-bottom: 1.5rem;
}

.search-page-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
}

.search-page-form button {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-small);
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #ffffff;
  cursor: pointer;
}

.search-page-form button:hover {
  background: var(--teal-hover);
}

.search-status {
  color: var(--muted);
}

.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 48rem;
}

.search-results li {
  margin: 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.search-results a {
  font-weight: 600;
  font-size: 1.08rem;
}

.search-results .result-page {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.15rem;
}

.search-results .result-snippet {
  margin: 0.35rem 0 0;
  color: var(--text);
  font-size: 0.95rem;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 3fr);
  gap: 2.5rem;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.93rem;
  margin-top: 0.85rem;
  max-width: 22rem;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

.footer-heading {
  font-size: 0.87rem;
  font-weight: 600;
  margin: 0 0 0.7rem;
  color: var(--text);
  letter-spacing: 0;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.93rem;
}

.footer-col a {
  color: var(--muted);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-meta {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-meta p {
  margin: 0 0 0.4rem;
  max-width: 60rem;
}

.footer-meta a {
  color: var(--muted);
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1199px) {
  .doc-shell {
    grid-template-columns: 14rem minmax(0, 1fr);
    grid-template-areas: "nav main";
    gap: 2.5rem;
  }

  .doc-toc {
    display: none;
  }

  .toc-compact {
    display: block;
  }

  .page-shell.has-toc {
    display: block;
  }
}

@media (max-width: 1099px) {
  .band-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .band h2 {
    max-width: 30ch;
  }
}

@media (max-width: 899px) {
  .doc-shell {
    display: block;
    padding-top: 1.5rem;
  }

  .doc-nav {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 3rem;
    padding: 1.5rem 0 0;
    border-top: 1px solid var(--line);
  }

  .browse-link {
    display: inline-block;
  }

  .hero-text {
    grid-template-columns: minmax(0, 1fr);
  }

  .interfaces {
    grid-template-columns: minmax(0, 1fr);
  }

  .interface + .interface {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .interface > p:last-child {
    margin-top: 0.5rem;
  }

  .channels {
    grid-template-columns: minmax(0, 1fr);
  }

  .channel + .channel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  body {
    font-size: 1rem;
  }

  .split,
  .benefits {
    grid-template-columns: minmax(0, 1fr);
  }

  .related ul {
    columns: 1;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-next {
    grid-column: 1;
  }

  .os-panel {
    padding: 1.1rem;
  }

  .interface {
    padding: 1.35rem 1.25rem;
  }

  /* The steps of a stage stack, and the way back becomes a line of text. */
  .flow {
    --dot-size: 2.3rem;
  }

  .flow-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .flow-steps::before {
    top: calc(var(--dot-size) / 2);
    bottom: calc(var(--dot-size) / 2);
    left: calc(var(--dot-size) / 2 - 1px);
    right: auto;
    width: 2px;
    height: auto;
    transform-origin: center top;
    animation-name: flow-track-down;
  }

  .flow-step {
    text-align: left;
    display: grid;
    grid-template-columns: var(--dot-size) 1fr;
    column-gap: 0.9rem;
    align-items: center;
    padding: 0;
  }

  .flow-step::before {
    grid-row: span 2;
    margin: 0;
  }

  .flow-step + .flow-step::after {
    display: none;
  }

  .flow-back,
  .flow-plan .flow-back {
    margin: 0.75rem 0 0;
    height: auto;
    border: 0;
  }

  .flow-back::before {
    display: none;
  }

  .flow-back span {
    position: static;
    transform: none;
    white-space: normal;
  }

  .flow-back span::before {
    content: "↺ ";
  }

  .flow-handoff {
    position: relative;
    text-align: left;
    padding: 0.9rem 0 0.9rem calc(var(--dot-size) + 0.9rem);
  }

  .flow-handoff::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--dot-size) / 2 - 1px);
    height: auto;
    margin: 0;
  }
}

@keyframes flow-track-down {
  from {
    transform: scaleY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media print {
  body {
    padding-top: 0;
  }

  .site-header,
  .site-footer,
  .doc-nav,
  .doc-toc,
  .pager,
  .copy-button {
    display: none !important;
  }
}
