@font-face {
  font-family: "Ubuntu Mono";
  src: url("fonts/UbuntuMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu Mono";
  src: url("fonts/UbuntuMono-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #f3efe6;
  --paper-raised: #faf8f2;
  --ink: #1d1e1a;
  --ink-soft: #5e6058;
  --rail: #171813;
  --rail-soft: #24251f;
  --rule: #d2cab9;
  --rule-dark: #3d3f35;
  --signal: #f39a18;
  --signal-soft: #ffe0a5;
  --blue: #247aa5;
  --green: #427b5b;
  --red: #a84436;
  --link-hover: #155a7c;
  --key-border: #aaa18f;
  --key-background: #fffdf7;
  --key-ink: #292a25;
  --pre-ink: #f4f1e8;
  --lede-ink: #4c4e47;
  --muted: #77786f;
  --muted-soft: #84857c;
  --figure-border: #c7beac;
  --paper-hover: #fffdf8;
  --table-head: #e8e2d7;
  --table-head-ink: #4d4f47;
  --arrow: #9d9688;
  --sidebar: 286px;
  --content: 790px;
  --toc: 190px;
  --font-app: "Ubuntu Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --shadow: 0 14px 44px rgb(31 27 18 / 12%);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #11120f;
  --paper-raised: #1a1b17;
  --ink: #efede5;
  --ink-soft: #b2b0a7;
  --rail: #0d0e0b;
  --rail-soft: #22231e;
  --rule: #383a32;
  --rule-dark: #4b4d43;
  --signal: #f3a01c;
  --signal-soft: #5b3a0d;
  --blue: #69b8dc;
  --green: #78b991;
  --red: #df7060;
  --link-hover: #9bd7ef;
  --key-border: #5b5d53;
  --key-background: #22231e;
  --key-ink: #f0eee6;
  --pre-ink: #f4f1e8;
  --lede-ink: #c7c5bb;
  --muted: #989a90;
  --muted-soft: #8b8d83;
  --figure-border: #42443a;
  --paper-hover: #242520;
  --table-head: #272821;
  --table-head-ink: #c5c3ba;
  --arrow: #77796f;
  --shadow: 0 16px 48px rgb(0 0 0 / 34%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 28px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-app);
  font-size: 16px;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

body.nav-open { overflow: hidden; }

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { color: var(--link-hover); }

button,
input { font: inherit; }

code,
kbd,
pre,
.mono,
.eyebrow,
.doc-meta,
.site-mark,
.nav-group-title,
.toc-title,
.step-number,
.command-name {
  font-family: var(--font-app);
}

code {
  padding: .12em .32em;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  font-size: .9em;
}

kbd {
  display: inline-block;
  min-width: 1.9em;
  margin: 0 .08em;
  padding: .1em .42em .14em;
  border: 1px solid var(--key-border);
  border-bottom-width: 3px;
  background: var(--key-background);
  color: var(--key-ink);
  font-size: .78em;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

pre {
  overflow-x: auto;
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border-left: 4px solid var(--signal);
  background: var(--rail);
  color: var(--pre-ink);
  font-size: .88rem;
  line-height: 1.65;
}

pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  overflow-y: auto;
  border-right: 1px solid #090a08;
  background: var(--rail);
  color: #dedbd0;
  scrollbar-color: #55574d transparent;
}

.sidebar-inner {
  min-height: 100%;
  padding: 26px 23px 34px;
}

.brand-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  color: #fffaf0;
  text-decoration: none;
}

.brand:hover { color: #fffaf0; }

.theme-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--rule-dark);
  border-radius: 0;
  background: #11120f;
  color: var(--signal);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--signal);
  outline: 0;
}

.site-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--signal);
  color: var(--signal);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.08em;
}

.brand-name {
  display: block;
  font-family: var(--font-app);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.05;
}

.brand-subtitle {
  display: block;
  margin-top: 3px;
  color: #97998e;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.manual-search {
  position: relative;
  margin: 24px 0 25px;
}

.manual-search input {
  width: 100%;
  height: 39px;
  padding: 0 36px 0 11px;
  border: 1px solid var(--rule-dark);
  border-radius: 0;
  outline: 0;
  background: #10110e;
  color: #f5f2e9;
  font-size: 14px;
}

.manual-search input::placeholder { color: #77796f; }

.manual-search input:focus { border-color: var(--signal); }

.search-key {
  position: absolute;
  top: 9px;
  right: 9px;
  color: #7d7f74;
  font: 12px/1.5 var(--font-app);
}

.search-results {
  position: absolute;
  z-index: 40;
  top: 44px;
  left: 0;
  width: min(410px, calc(100vw - 42px));
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid #4c4e43;
  background: #11120f;
  box-shadow: 0 16px 35px rgb(0 0 0 / 36%);
}

.search-results[hidden] { display: none; }

.search-result {
  display: block;
  padding: 11px 12px 12px;
  border-bottom: 1px solid #2f302a;
  color: #ece9df;
  text-decoration: none;
}

.search-result:last-child { border-bottom: 0; }
.search-result:hover,
.search-result.is-active { background: var(--rail-soft); color: white; }
.search-result strong { display: block; color: var(--signal); font-size: 14px; }
.search-result span { display: block; margin-top: 2px; color: #aaa99f; font-size: 12px; line-height: 1.45; }
.search-empty { padding: 14px 12px; color: #9b9d92; font-size: 13px; }

.manual-nav { margin-top: 4px; }
.nav-group { margin: 0 0 21px; }
.nav-group-title {
  margin: 0 0 6px;
  color: #777a6e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  display: block;
  margin: 0 -8px;
  padding: 5px 8px 5px 16px;
  color: #c3c4ba;
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
}

.nav-link::before {
  position: absolute;
  top: 11px;
  left: 1px;
  width: 5px;
  height: 5px;
  background: transparent;
  content: "";
}

.nav-link:hover { background: #20211c; color: white; }
.nav-link[aria-current="page"] { color: white; font-weight: 650; }
.nav-link[aria-current="page"]::before { background: var(--signal); }

.sidebar-foot {
  margin-top: 28px;
  padding-top: 15px;
  border-top: 1px solid #35362f;
  color: #77796f;
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-foot a { color: #a6a89d; }

.mobile-header { display: none; }

.page-shell {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--content)) var(--toc);
  gap: 68px;
  align-items: start;
  width: min(calc(var(--content) + var(--toc) + 68px), calc(100% - 96px));
  margin: 0 auto;
  padding: 58px 0 90px;
}

main { min-width: 0; }

.doc-header {
  margin-bottom: 41px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--red);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--font-app);
  font-weight: 700;
  line-height: 1.16;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(38px, 5vw, 58px);
  letter-spacing: -.035em;
}

.lede {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--lede-ink);
  font-family: var(--font-app);
  font-size: 20px;
  line-height: 1.55;
}

.doc-meta {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

h2 {
  margin: 3.5rem 0 1rem;
  padding-top: .2rem;
  font-size: 30px;
  letter-spacing: -.025em;
}

h2::before {
  display: block;
  width: 31px;
  height: 4px;
  margin-bottom: 13px;
  background: var(--signal);
  content: "";
}

h3 {
  margin: 2.25rem 0 .75rem;
  font-size: 21px;
  letter-spacing: -.01em;
}

h4 {
  margin: 1.75rem 0 .55rem;
  font-size: 17px;
}

p { margin: 0 0 1.1rem; }
ul,
ol { margin: 0 0 1.25rem; padding-left: 1.45rem; }
li { margin: .35rem 0; }
li::marker { color: var(--red); }

.toc {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding-left: 17px;
  border-left: 1px solid var(--rule);
}

.toc-title {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
}

.toc a.depth-3 { padding-left: 10px; }
.toc a:hover,
.toc a.is-active { color: var(--ink); }
.toc a.is-active { font-weight: 700; }

.figure {
  margin: 2rem 0;
  border: 1px solid var(--figure-border);
  background: #181916;
  box-shadow: var(--shadow);
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

.figure figcaption {
  padding: 10px 13px 11px;
  border-top: 1px solid #36372f;
  background: #20211d;
  color: #c8c6bc;
  font-size: 13px;
  line-height: 1.45;
}

.figure figcaption strong { color: var(--signal); font-weight: 700; }

.figure-phone {
  width: min(100%, 430px);
  margin-right: auto;
  margin-left: auto;
}

.figure-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 2rem 0;
}

.figure-pair .figure { margin: 0; }

.control-overview {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  margin: 1.7rem 0 2.4rem;
}

.control-pad-figure { margin: 0; }

.control-pad-crop {
  aspect-ratio: 1.08;
  overflow: hidden;
  background: #000;
}

.figure .control-pad-crop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.control-legend {
  border-top: 1px solid var(--rule);
}

.control-key {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 61px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}

.control-glyph {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--key-border);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
}

.control-key strong { display: block; color: var(--red); font-size: 14px; }
.control-key span:last-child { display: block; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }

.callout {
  margin: 1.7rem 0;
  padding: 17px 19px 17px 20px;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--blue);
  background: var(--paper-raised);
}

.callout.warning { border-left-color: var(--signal); }
.callout.danger { border-left-color: var(--red); }
.callout.success { border-left-color: var(--green); }
.callout-title {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.callout p:last-child,
.callout ul:last-child { margin-bottom: 0; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 1.8rem 0;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.quick-link {
  min-height: 146px;
  padding: 18px 19px;
  background: var(--paper-raised);
  color: var(--ink);
  text-decoration: none;
}

.quick-link:hover { background: var(--paper-hover); color: var(--ink); }
.quick-link .mono { color: var(--red); font-size: 11px; letter-spacing: .08em; }
.quick-link strong { display: block; margin: 8px 0 5px; font-family: var(--font-app); font-size: 20px; }
.quick-link span { display: block; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }

.steps {
  margin: 1.6rem 0 2rem;
  border-top: 1px solid var(--rule);
}

.step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 13px;
  padding: 17px 0;
  border-bottom: 1px solid var(--rule);
}

.step-number {
  color: var(--signal);
  font-size: 13px;
  font-weight: 800;
}

.step strong { display: block; margin-bottom: 3px; }
.step p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.key-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 1.6rem 0;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.key-card {
  min-height: 126px;
  padding: 15px;
  background: var(--paper-raised);
}

.key-card strong { display: block; margin: 8px 0 4px; font-size: 14px; }
.key-card p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--rule);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-raised);
  font-size: 14px;
  line-height: 1.5;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

tr:last-child td { border-bottom: 0; }
th {
  background: var(--table-head);
  color: var(--table-head-ink);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.screen-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr) 32px minmax(0, 1fr);
  gap: 8px;
  margin: 1.5rem 0;
}

.screen-node {
  padding: 12px 10px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  text-align: center;
}
.screen-node strong { display: block; color: var(--red); font: 13px var(--font-app); }
.screen-node span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 12px; }
.screen-arrow { display: grid; place-items: center; color: var(--arrow); }

.command-list { margin: 1.5rem 0; border-top: 1px solid var(--rule); }
.command {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--rule);
}
.command-name { color: var(--red); font-size: 14px; font-weight: 800; }
.command p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 4rem;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.page-nav a {
  min-height: 92px;
  padding: 16px 18px;
  background: var(--paper-raised);
  color: var(--ink);
  text-decoration: none;
}
.page-nav a:last-child { text-align: right; }
.page-nav a:hover { background: var(--paper-hover); }
.page-nav small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.page-nav strong { display: block; margin-top: 4px; font-family: var(--font-app); font-size: 17px; }

.lightbox {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 0;
  background: rgb(12 13 11 / 94%);
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(1100px, 95vw); max-height: 88vh; box-shadow: 0 20px 70px black; }
.lightbox-close { position: absolute; top: 17px; right: 20px; border: 0; background: transparent; color: white; font-size: 28px; cursor: pointer; }

.mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #42443a;
  background: #11120f;
  color: white;
  cursor: pointer;
}

.mobile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 1180px) {
  .page-grid {
    grid-template-columns: minmax(0, var(--content));
    width: min(var(--content), calc(100% - 64px));
  }
  .toc { display: none; }
}

@media (max-width: 820px) {
  html { scroll-padding-top: 82px; }
  .sidebar {
    width: min(330px, 88vw);
    transform: translateX(-105%);
    box-shadow: 18px 0 50px rgb(0 0 0 / 35%);
    transition: transform 170ms ease-out;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .page-shell { margin-left: 0; }
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid #34362e;
    background: var(--rail);
    color: white;
  }
  .mobile-header .brand-name { font-size: 18px; }
  .mobile-menu { display: grid; place-items: center; }
  .page-grid { width: min(var(--content), calc(100% - 38px)); padding-top: 38px; }
  .doc-header { margin-bottom: 30px; }
  .figure-pair { grid-template-columns: 1fr; }
  .control-overview { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .page-grid { width: calc(100% - 28px); padding: 28px 0 60px; }
  h1 { font-size: 38px; }
  .lede { font-size: 18px; }
  h2 { font-size: 26px; }
  .quick-grid,
  .key-map { grid-template-columns: 1fr; }
  .quick-link { min-height: 0; }
  .command { grid-template-columns: 1fr; gap: 5px; }
  .screen-map { grid-template-columns: 1fr; }
  .screen-arrow { height: 20px; transform: rotate(90deg); }
  .page-nav { grid-template-columns: 1fr; }
  .page-nav a:last-child { text-align: left; }
}

@media print {
  :root,
  :root[data-theme="dark"] {
    --paper: white;
    --paper-raised: white;
    --ink: black;
    --ink-soft: #333;
    --lede-ink: #333;
    --rule: #bbb;
    --table-head: #eee;
    --table-head-ink: #222;
    color-scheme: light;
  }
  .sidebar,
  .mobile-header,
  .toc,
  .page-nav { display: none !important; }
  .page-shell { margin: 0; }
  .page-grid { display: block; width: auto; padding: 0; }
  body { background: white; color: black; font-size: 11pt; }
  .figure { box-shadow: none; break-inside: avoid; }
  a { color: black; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
