/* Flyghtdeck docs — the user guide beside the app.
   One page (index.html), this stylesheet and docs.js are the whole site; there is no build step.
   The palette is the app's own (www-app/src/styles.scss), dark and light, so the docs and the
   product read as one thing. Theme values live only in the two :root blocks below. */

/* Quicksand — the wordmark's face, exactly as the app uses it. Self-hosted so no third party
   sees a page load. */
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('/fonts/quicksand-latin.woff2') format('woff2');
}

:root {
  color-scheme: dark;
  --canvas: #010409;
  --bg: #0d1117;
  --panel: #161b22;
  --raised: #21262d;
  --border: #30363d;
  --muted: #8b949e;
  --text: #f0f6fc;
  --text-soft: #c9d1d9;
  --accent: #2f81f7;
  --accent-hover: #1f6feb;
  --accent-tint: rgba(47, 129, 247, 0.12);
  --green: #3fb950;
  --red: #f85149;
  --orange: #f0883e;
  --yellow: #d29922;
  --yellow-tint: rgba(210, 153, 34, 0.12);
  --hairline: rgba(255, 255, 255, 0.06);
  --hover: rgba(255, 255, 255, 0.06);
  --shadow: rgba(1, 4, 9, 0.6);
  --term-bg: #0d1117;
  --term-border: #30363d;
  --term-text: #c9d1d9;
  --term-cmd: #7ee787;
  --term-error: #f85149;
  --term-time: #6e7681;
  --on-fill: #ffffff;

  --header: 56px;
  --side: 256px;
  --measure: 760px;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

:root[data-theme='light'] {
  color-scheme: light;
  --canvas: #eaeef2;
  --bg: #ffffff;
  --panel: #f6f8fa;
  --raised: #eaeef2;
  --border: #d0d7de;
  --muted: #656d76;
  --text: #1f2328;
  --text-soft: #424a53;
  --accent: #0969da;
  --accent-hover: #0860ca;
  --accent-tint: rgba(9, 105, 218, 0.08);
  --green: #1a7f37;
  --red: #d1242f;
  --orange: #bc4c00;
  --yellow: #9a6700;
  --yellow-tint: rgba(154, 103, 0, 0.09);
  --hairline: rgba(0, 0, 0, 0.08);
  --hover: rgba(0, 0, 0, 0.05);
  --shadow: rgba(140, 149, 159, 0.3);
  --term-bg: #e8ebef;
  --term-border: #d0d7de;
  --term-text: #424a53;
  --term-cmd: #1a7f37;
  --term-error: #cf222e;
  --term-time: #6e7781;
}

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

html {
  /* The sticky header must not sit on top of an anchored heading. */
  scroll-padding-top: calc(var(--header) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-soft);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ───────────── Header ───────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand__name {
  font-family: 'Quicksand', var(--font);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.brand__tag {
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.top__spacer {
  flex: 1;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.iconbtn:hover {
  color: var(--text);
  background: var(--hover);
}

.iconbtn svg {
  width: 18px;
  height: 18px;
}

/* The toggle previews the theme a click leads to, as the app's does. */
.theme__sun,
:root[data-theme='light'] .theme__moon {
  display: block;
}

.theme__moon,
:root[data-theme='light'] .theme__sun {
  display: none;
}

.menubtn {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--on-fill);
  background: var(--accent);
  border-radius: var(--radius);
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* ───────────── Search ───────────── */

.search {
  position: relative;
  width: min(340px, 40vw);
}

.search__input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 34px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.search__glyph {
  position: absolute;
  left: 10px;
  top: 9px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

/* Centred in the field, and its glyph centred in the key: a fixed box with even borders. */
.search__key {
  position: absolute;
  right: 7px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  line-height: 1;
  border-bottom-width: 1px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search__input:focus ~ .search__key,
.search__input:not(:placeholder-shown) ~ .search__key {
  display: none;
}

.search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(60vh, 420px);
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px var(--shadow);
}

.search__results[hidden] {
  display: none;
}

.search__hit {
  display: block;
  padding: 7px 10px;
  color: var(--text-soft);
  border-radius: 6px;
}

.search__hit:hover,
.search__hit--on {
  background: var(--hover);
  text-decoration: none;
}

.search__hit strong {
  display: block;
  font-size: 0.87rem;
  color: var(--text);
}

.search__hit span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search__none {
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ───────────── Layout ───────────── */

.layout {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  max-width: 1180px;
  margin: 0 auto;
}

.side {
  position: sticky;
  top: var(--header);
  align-self: start;
  height: calc(100vh - var(--header));
  padding: 24px 12px 40px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--hairline);
}

.side__group {
  margin: 18px 0 6px;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.side__group:first-child {
  margin-top: 0;
}

.side__link {
  display: block;
  padding: 5px 10px;
  font-size: 0.88rem;
  color: var(--text-soft);
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
}

.side__link:hover {
  color: var(--text);
  background: var(--hover);
  text-decoration: none;
}

.side__link--on {
  color: var(--text);
  font-weight: 600;
  background: var(--accent-tint);
  border-left-color: var(--accent);
}

.scrim {
  display: none;
}

.content {
  min-width: 0;
  max-width: calc(var(--measure) + 96px);
  padding: 40px 48px 96px;
}

/* ───────────── Type ───────────── */

h1,
h2,
h3 {
  color: var(--text);
  line-height: 1.25;
}

h1 {
  margin: 0 0 12px;
  font-size: 2.1rem;
  letter-spacing: -0.01em;
}

h2 {
  margin: 64px 0 14px;
  padding-top: 32px;
  font-size: 1.5rem;
  border-top: 1px solid var(--border);
}

h3 {
  margin: 34px 0 8px;
  font-size: 1.08rem;
}

/* A heading links to itself; the mark shows on hover. */
.anchor {
  margin-left: 8px;
  font-weight: 400;
  color: var(--muted);
  opacity: 0;
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

p,
ul,
ol {
  margin: 0 0 16px;
}

ul,
ol {
  padding-left: 22px;
}

li {
  margin-bottom: 6px;
}

li::marker {
  color: var(--muted);
}

strong {
  color: var(--text);
  font-weight: 600;
}

.lede {
  font-size: 1.12rem;
  color: var(--text-soft);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

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

code {
  padding: 0.12em 0.4em;
  font-size: 0.85em;
  color: var(--text);
  background: var(--raised);
  border-radius: 5px;
}

kbd {
  padding: 1px 6px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* A label as it reads in the app: a button, tab or menu item. */
.ui {
  padding: 0 0.35em;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 5px;
}

/* ───────────── Cards ───────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin: 28px 0 8px;
  padding: 0;
  list-style: none;
}

.cards li {
  margin: 0;
}

.card {
  display: block;
  height: 100%;
  padding: 16px;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.card strong {
  display: block;
  margin: 8px 0 2px;
}

.card span {
  font-size: 0.87rem;
  color: var(--muted);
}

/* ───────────── Steps ───────────── */

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

.steps > li {
  position: relative;
  margin: 0;
  padding: 0 0 20px 44px;
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent);
  border-radius: 50%;
}

/* The line that joins one step to the next. */
.steps > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13.5px;
  top: 34px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.steps > li > :last-child {
  margin-bottom: 0;
}

/* ───────────── Notes ───────────── */

.note {
  margin: 20px 0;
  padding: 12px 16px;
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note--warn {
  background: var(--yellow-tint);
  border-left-color: var(--yellow);
}

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

.note__title {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

/* ───────────── Code and terminal ───────────── */

.code {
  position: relative;
  margin: 16px 0 20px;
}

pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--term-text);
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
}

pre code {
  padding: 0;
  font-size: inherit;
  color: inherit;
  background: none;
}

.code__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
}

.code:hover .code__copy,
.code__copy:focus-visible {
  opacity: 1;
}

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

/* A run's log as the Console shows it: a time column, the platform's own lines in green. */
.term .t {
  color: var(--term-time);
}

.term .sys {
  color: var(--term-cmd);
}

.term .err {
  color: var(--term-error);
}

.c {
  color: var(--term-time);
}

/* ───────────── Tables ───────────── */

.table {
  margin: 16px 0 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

tr:last-child td {
  border-bottom: 0;
}

th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
}

td:first-child {
  color: var(--text);
  white-space: nowrap;
}

/* A run status as the app draws it: a dot beside the word. */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot--green {
  background: var(--green);
}

.dot--red {
  background: var(--red);
}

.dot--orange {
  background: var(--orange);
}

.dot--blue {
  background: var(--accent);
}

.dot--hollow {
  background: transparent;
  border: 2px solid var(--yellow);
}

/* ───────────── Footer ───────────── */

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 72px;
  padding-top: 24px;
  font-size: 0.87rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.foot__spacer {
  flex: 1;
}

[hidden] {
  display: none !important;
}

/* ───────────── Narrow screens ───────────── */

@media (max-width: 900px) {
  .layout {
    display: block;
  }

  .menubtn {
    display: inline-flex;
  }

  .brand__tag,
  .search__key,
  .top__spacer {
    display: none;
  }

  .brand {
    margin-right: auto;
  }

  .search {
    flex: 0 1 190px;
    width: auto;
    min-width: 0;
  }

  .search__results {
    position: fixed;
    top: calc(var(--header) + 6px);
    left: 12px;
    right: 12px;
  }

  /* The section list becomes a drawer that slides in from the left edge. */
  .side {
    position: fixed;
    top: var(--header);
    left: calc(-1 * min(84vw, 320px));
    z-index: 25;
    width: min(84vw, 320px);
    background: var(--panel);
    border-right: 1px solid var(--border);
    transition: left 0.18s ease;
  }

  .nav-open .side {
    left: 0;
  }

  .nav-open .scrim {
    display: block;
    position: fixed;
    inset: var(--header) 0 0 0;
    z-index: 20;
    background: var(--shadow);
  }

  .content {
    padding: 28px 20px 72px;
  }

  h1 {
    font-size: 1.7rem;
  }

  h2 {
    margin-top: 48px;
  }

  .top {
    padding: 0 12px;
    gap: 8px;
  }

  .top .btn span {
    display: none;
  }

  .code__copy {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .side {
    transition: none;
  }
}

@media print {
  .top,
  .side,
  .code__copy,
  .anchor {
    display: none;
  }

  .layout {
    display: block;
  }
}
