/* Bellows docs. Layout follows the familiar developer-docs pattern: header,
   left navigation, a readable article column and an "On this page" rail. */

:root {
  --bg: #ffffff;
  --bg-subtle: #f8f9fa;
  --bg-hover: #f1f3f4;
  --text: #202124;
  --text-muted: #5f6368;
  --border: #dadce0;
  --border-strong: #bdc1c6;
  --link: #1a73e8;
  --link-hover: #174ea6;
  --nav-active-bg: #e8f0fe;
  --nav-active-text: #1967d2;
  --brand: #12894a;
  --code-bg: #f1f3f4;
  --note-bg: #e8f0fe;  --note-border: #1a73e8;  --note-label: #174ea6;
  --tip-bg: #e6f4ea;   --tip-border: #1e8e3e;   --tip-label: #137333;
  --warn-bg: #fef7e0;  --warn-border: #f9ab00;  --warn-label: #b06000;
  --marker-bg: #1a73e8; --marker-text: #ffffff;
  --shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 2px 6px 2px rgba(60, 64, 67, .15);
  --header-h: 64px;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1f1f;
    --bg-subtle: #282a2c;
    --bg-hover: #303134;
    --text: #e3e3e3;
    --text-muted: #9aa0a6;
    --border: #3c4043;
    --border-strong: #5f6368;
    --link: #8ab4f8;
    --link-hover: #aecbfa;
    --nav-active-bg: #233753;
    --nav-active-text: #a8c7fa;
    --brand: #35c07a;
    --code-bg: #303134;
    --note-bg: #1c2a3e;  --note-border: #8ab4f8;  --note-label: #a8c7fa;
    --tip-bg: #1b2e22;   --tip-border: #81c995;   --tip-label: #a8dab5;
    --warn-bg: #352b14;  --warn-border: #fdd663;  --warn-label: #fdd663;
    --marker-bg: #8ab4f8; --marker-text: #202124;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 8px 3px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1f1f1f; --bg-subtle: #282a2c; --bg-hover: #303134; --text: #e3e3e3; --text-muted: #9aa0a6;
  --border: #3c4043; --border-strong: #5f6368; --link: #8ab4f8; --link-hover: #aecbfa;
  --nav-active-bg: #233753; --nav-active-text: #a8c7fa; --brand: #35c07a; --code-bg: #303134;
  --note-bg: #1c2a3e; --note-border: #8ab4f8; --note-label: #a8c7fa;
  --tip-bg: #1b2e22; --tip-border: #81c995; --tip-label: #a8dab5;
  --warn-bg: #352b14; --warn-border: #fdd663; --warn-label: #fdd663;
  --marker-bg: #8ab4f8; --marker-text: #202124; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; }
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; padding: 8px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; }
.skip-link:focus { top: 8px; }

/* ---------------------------------------------------------------- header -- */
.header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: var(--header-h); padding: 0 24px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; color: var(--text); }
/* logo.png is a 30-cell pixel grid drawn at 4 px a cell, so 30px keeps it crisp. */
.logo {
  flex: none; width: 30px; height: 30px; background-color: var(--brand);
  -webkit-mask: url("logo.png") center / 30px 30px no-repeat;
          mask: url("logo.png") center / 30px 30px no-repeat;
}
.brand-name { font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.brand-docs { font-size: 20px; color: var(--text-muted); padding-left: 10px; border-left: 1px solid var(--border); }
.menu-button {
  display: none; flex: none; width: 40px; height: 40px; margin-left: -8px; padding: 8px;
  border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer;
}
.menu-button:hover { background: var(--bg-hover); }
.menu-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.search > svg {
  position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%);
  fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search input[type="search"] {
  width: 100%; height: 44px; padding: 0 44px 0 46px;
  border: 1px solid transparent; border-radius: 8px;
  background: var(--bg-hover); color: var(--text); font: inherit; font-size: 15px;
}
.search input[type="search"]::placeholder { color: var(--text-muted); }
.search input[type="search"]:focus { outline: none; background: var(--bg); border-color: var(--link); box-shadow: var(--shadow); }
.search input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-key {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  padding: 0 7px; border: 1px solid var(--border-strong); border-radius: 4px;
  color: var(--text-muted); font: 12px/20px var(--mono);
}
.search input:focus ~ .search-key { display: none; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  max-height: min(70vh, 560px); overflow-y: auto; padding: 8px 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.search-results a { display: block; padding: 10px 16px; color: var(--text); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--bg-hover); text-decoration: none; }
.search-results .r-title { display: block; font-weight: 500; color: var(--link); }
.search-results .r-path { display: block; font-size: 12px; color: var(--text-muted); }
.search-results .r-text { display: block; font-size: 14px; color: var(--text-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-results mark { background: none; color: var(--text); font-weight: 700; }
.search-results .r-empty { padding: 10px 16px; color: var(--text-muted); font-size: 14px; }

.open-app {
  flex: none; padding: 9px 20px; border-radius: 20px;
  background: var(--link); color: #fff; font-size: 14px; font-weight: 500;
}
.open-app:hover { color: #fff; text-decoration: none; filter: brightness(1.08); box-shadow: var(--shadow); }
:root[data-theme="dark"] .open-app { color: #202124; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .open-app { color: #202124; } }

/* ---------------------------------------------------------------- layout -- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--header-h); flex: none;
  width: 272px; height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 20px 12px 40px 16px; border-right: 1px solid var(--border);
  font-size: 14px;
}
.nav-group + .nav-group { margin-top: 18px; }
.nav-heading { margin: 0 0 4px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--text); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 6px 12px; border-radius: 0 16px 16px 0; margin-left: -16px; padding-left: 28px;
  color: var(--text-muted); line-height: 1.4;
}
.sidebar li a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.sidebar li a[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 500; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; justify-content: center; gap: 48px; padding: 0 40px; }
.content { flex: 1; min-width: 0; max-width: 800px; padding: 28px 0 64px; }

.toc {
  position: sticky; top: calc(var(--header-h) + 28px); flex: none;
  width: 220px; max-height: calc(100vh - var(--header-h) - 56px); overflow-y: auto;
  padding: 0 0 24px; font-size: 13px;
}
.toc-title { margin: 0 0 8px; font-weight: 500; color: var(--text); font-size: 14px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--text-muted); line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.is-active { color: var(--link); border-left-color: var(--link); }

/* -------------------------------------------------------------- content -- */
.breadcrumbs { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 14px; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--link); }
h1, h2, h3, h4 { color: var(--text); font-weight: 400; line-height: 1.3; }
h1 { margin: 0 0 20px; font-size: 34px; letter-spacing: -.01em; }
h2 { margin: 44px 0 12px; font-size: 26px; padding-top: 4px; }
h3 { margin: 30px 0 8px; font-size: 20px; font-weight: 500; }
h4 { margin: 24px 0 6px; font-size: 16px; font-weight: 500; }
h2, h3 { position: relative; }
.anchor { margin-left: 8px; color: var(--text-muted); opacity: 0; font-weight: 400; text-decoration: none; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.anchor:hover { color: var(--link); text-decoration: none; }
p { margin: 0 0 16px; }
.lead { font-size: 18px; line-height: 1.55; color: var(--text-muted); margin-bottom: 24px; }
ul, ol { margin: 0 0 16px; padding-left: 26px; }
li { margin: 4px 0; }
li > ul, li > ol { margin: 6px 0; }
strong, b { font-weight: 500; }
code, kbd {
  font-family: var(--mono); font-size: 87.5%; padding: 1px 5px; border-radius: 4px; background: var(--code-bg);
}
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--bg); }
hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* Numbered procedure steps. */
ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin: 12px 0; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-hover); color: var(--text); font-size: 13px; font-weight: 500; line-height: 26px; text-align: center;
}

/* Callouts. */
.callout { margin: 20px 0; padding: 14px 18px; border-left: 4px solid; border-radius: 0 6px 6px 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-label { font-weight: 500; }
.callout-note { background: var(--note-bg); border-color: var(--note-border); }
.callout-note .callout-label { color: var(--note-label); }
.callout-tip { background: var(--tip-bg); border-color: var(--tip-border); }
.callout-tip .callout-label { color: var(--tip-label); }
.callout-caution { background: var(--warn-bg); border-color: var(--warn-border); }
.callout-caution .callout-label { color: var(--warn-label); }

/* Tables. */
.table-wrap { overflow-x: auto; margin: 20px 0 24px; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--bg-subtle); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
td.wrap, th.wrap { white-space: normal; }

/* Screenshots. */
figure { margin: 24px 0 28px; }
figure.narrow { max-width: 420px; }
figure.medium { max-width: 600px; }
figure.tall { max-width: 300px; }
.shot { position: relative; line-height: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-subtle); }
.shot img { display: block; width: 100%; }
a.shot-link { display: block; line-height: 0; }
figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.marker {
  position: absolute; transform: translate(-50%, -50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--marker-bg); color: var(--marker-text); box-shadow: 0 0 0 2px var(--bg), var(--shadow);
  font: 500 13px/26px var(--font); text-align: center; pointer-events: none;
}
@media (max-width: 640px) { .marker { width: 20px; height: 20px; font-size: 11px; line-height: 20px; } }
.legend { counter-reset: none; }
.legend td:first-child { width: 44px; text-align: center; }
.num {
  display: inline-block; width: 24px; height: 24px; border-radius: 50%;
  background: var(--marker-bg); color: var(--marker-text); font-size: 12px; font-weight: 500; line-height: 24px; text-align: center;
}

/* Two screenshots side by side. */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin: 24px 0; }
.pair figure { margin: 0; }
.pair-side { grid-template-columns: 240px minmax(0, 1fr); gap: 28px; }
.pair-side .table-wrap { margin-top: 0; }
@media (max-width: 640px) { .pair, .pair-side { grid-template-columns: 1fr; } .pair-side figure { max-width: 300px; } }

/* Landing page cards. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 24px 0 32px; }
.card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 12px; font-size: 14px; color: var(--text-muted); }
.card ul { list-style: none; padding: 0; margin: auto 0 0; font-size: 14px; }
.card li { margin: 6px 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.hero .lead { max-width: 680px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 8px; }
.button {
  display: inline-block; padding: 9px 20px; border: 1px solid var(--border-strong); border-radius: 20px;
  color: var(--link); font-size: 14px; font-weight: 500;
}
.button:hover { background: var(--nav-active-bg); text-decoration: none; }
.button.primary { background: var(--link); border-color: var(--link); color: #fff; }
.button.primary:hover { color: #fff; filter: brightness(1.08); }
:root[data-theme="dark"] .button.primary { color: #202124; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .button.primary { color: #202124; } }

/* Glossary. */
dl.glossary { margin: 0 0 24px; }
dl.glossary dt { margin-top: 20px; font-weight: 500; font-size: 17px; }
dl.glossary dd { margin: 4px 0 0; }

/* Previous / next. */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--border); border-radius: 8px; color: var(--link); font-weight: 500; }
.pager a:hover { border-color: var(--link); text-decoration: none; }
.pager span { display: block; font-size: 13px; font-weight: 400; color: var(--text-muted); }
.pager-next { text-align: right; }
.page-footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.page-footer p { margin: 0 0 6px; }

/* --------------------------------------------------------- responsive -- */
@media (max-width: 1200px) { .toc { display: none; } }
@media (max-width: 960px) {
  .menu-button { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50; height: 100vh; width: 300px; max-width: 85vw;
    padding-top: 20px; background: var(--bg); transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow); visibility: hidden;
  }
  .sidebar.is-open { transform: none; visibility: visible; }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(32, 33, 36, .45); }
  .main { padding: 0 24px; }
}
@media (max-width: 720px) {
  .header { gap: 8px; padding: 0 16px; }
  .brand-docs, .open-app { display: none; }
  .search-key { display: none; }
  .main { padding: 0 16px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .lead { font-size: 17px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media print {
  .header, .sidebar, .toc, .pager { display: none; }
  .main { padding: 0; }
}
