:root {
  color-scheme: dark light;
  --bg: #0d0f13;
  --card: #161a21;
  --line: #262c36;
  --text: #e8eaed;
  --muted: #98a1ae;
  --accent: #5b8cff;
  --on-accent: #0d0f13;
  --accent-text: #8fb0ff;
  --ok-line: #2f6b4f;
  --ok-bg: #12241b;
  --error-line: #7a3b3b;
  --error-bg: #241414;
  --ok-text: #4cc38a;
  --error-text: #ff7b72;
  --warn: #e0a100;
  --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%230d0f13' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --line: #dfe3e9;
    --text: #14171c;
    --muted: #5b6672;
    --accent: #2b5fd9;
    --on-accent: #ffffff;
    --accent-text: #2b5fd9;
    --ok-line: #b7dcc6;
    --ok-bg: #eefaf2;
    --error-line: #e8bcbc;
    --error-bg: #fdf1f1;
    --ok-text: #1a7f37;
    --error-text: #c62828;
    --warn: #8a6100;
    --check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Every link is the accent, visited or not; a class on a link sets its own color over this. */
a { color: var(--accent); }

.form-label { font-size: 13px; color: var(--muted); }

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
}

.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.input::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* Drawn from the palette, not the browser's, so an unchecked control reads as enabled in both themes. */
input[type="radio"], input[type="checkbox"] {
  appearance: none;
  flex: none;
  width: 16px; height: 16px;
  margin: 0;
  border: 1.5px solid var(--muted);
  background: var(--card) center / 12px 12px no-repeat;
  cursor: pointer;
}

input[type="radio"] { border-radius: 50%; }
input[type="checkbox"] { border-radius: 4px; }
input[type="radio"]:checked { border-color: var(--accent); background-color: var(--accent); box-shadow: inset 0 0 0 3px var(--card); }
input[type="checkbox"]:checked { border-color: var(--accent); background-color: var(--accent); background-image: var(--check-mark); }
input[type="radio"]:focus-visible, input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.copy-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.copy-row > code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.copy-button { flex: none; padding: 6px 12px; font-size: 13px; }
.copy-button-copied { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.code-block { position: relative; }
.code-block > pre, .code-block > div { padding-right: 84px; }
.code-block > .copy-button { position: absolute; top: 8px; right: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block {
  width: 100%;
  margin-top: 16px;
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}
.docs-shell { min-height: 100vh; display: flex; flex-direction: column; }

.docs-body {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 0;
  flex: 1;
}

/* On a phone the page list hides behind the menu button, so the page starts at its title. */
.docs-menu { display: none; }

@media (max-width: 720px) {
  .docs-body { grid-template-columns: minmax(0, 1fr); }
  .docs-body > .docs-side { display: none; }
  .docs-menu {
    display: block;
    position: relative;
    border-bottom: 1px solid var(--line);
    background: var(--card);
  }
}

.docs-menu-button {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.docs-menu-button::-webkit-details-marker { display: none; }
.docs-menu-icon { font-size: 18px; line-height: 1; color: var(--muted); }

.docs-menu-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-menu-rule { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

.docs-side {
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
}

.docs-side-link {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.docs-side-link:hover { color: var(--text); background: var(--bg); }

.docs-side-link-current {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.docs-main {
  padding: 26px 20px 60px;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.docs-main h2 {
  margin: 18px 0 0;
  font-size: 19px;
  font-weight: 600;
}

.docs-main p { margin: 0; color: var(--muted); }

.docs-main ul { margin: 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

.docs-main a { color: var(--accent); }

/* A name from the code, inside a sentence, set apart from the words around it. */
.docs-main p code, .docs-main li code, .docs-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.docs-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  /* Wraps rather than scrolls: a scrollbar is invisible on a Mac until something scrolls it,
     so a clipped line is a line the reader cannot tell is there. overflow-wrap is for a token
     with nowhere to break, such as a URL. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: var(--text);
  margin: 0;
}

/* A bar down the side rather than a box, so a note never reads as a code sample. */
.docs-note {
  border-left: 3px solid var(--muted);
  padding: 4px 0 4px 13px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
}

/* What the reader's own app adds to a page anybody can read. */
.docs-note-yours {
  border-color: var(--accent);
  color: var(--text);
}

/* One line: the plan, and Upgrade to Pro at its end. */
.docs-note-line { align-items: center; justify-content: space-between; }
.docs-note-action { font-weight: 600; white-space: nowrap; }

.docs-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.docs-table th,
.docs-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.docs-table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.docs-yes { color: var(--accent); font-weight: 700; }

.docs-yes svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.docs-no { color: var(--muted); }

.docs-scroll { overflow-x: auto; }
/* The footer sits at the bottom of the window however short the page above it is. */
.site-page { min-height: 100vh; display: flex; flex-direction: column; }
.site-page > .site-foot { margin-top: auto; }

.site-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.site-mark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-glyph {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.site-navigation { display: flex; gap: 18px; }
.site-link { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-link:hover { color: var(--text); }
.site-link-current { color: var(--text); font-weight: 600; }

.site-end { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }

.site-who {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.site-action {
  white-space: nowrap;
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.site-foot-navigation { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-foot-navigation a { color: var(--muted); }

/* A phone keeps the mark and the way in; the two page links move to the footer. */
@media (max-width: 560px) {
  .site-navigation { display: none; }
  .site-who { display: none; }
  .site-foot-navigation { margin-left: 0; }
}
