:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #5b5e66;
  --border: #dcdde0;
  --accent: #1f4f8f;
  --accent-hover: #173d70;
  --accent-text: #ffffff;
  --accent-soft: #e8eef7;
  --badge-bg: #fdf1dc;
  --badge-text: #7a4600;
  --focus: #2f6fd0;
  --note-bg: #fff8e6;
  --note-border: #e9cf8f;
  --code-bg: #f3f4f6;
  --hl-keyword: #a3195b;
  --hl-string: #1b6b2f;
  --hl-number: #8a4b00;
  --hl-comment: #5e6570;
  --hl-title: #6a3fb5;
  --hl-attr: #0b5a8a;
  --header-bg: #1f4f8f;
  --header-text: #ffffff;
  --radius: 10px;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Source Serif Pro", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1e2024;
    --text: #e8e9eb;
    --muted: #a5a8b0;
    --border: #34373d;
    --accent: #8db4f0;
    --accent-hover: #a9c7f5;
    --accent-text: #0e1a2c;
    --accent-soft: #22324a;
    --badge-bg: #3d2c10;
    --badge-text: #f3c77c;
    --focus: #8db4f0;
    --note-bg: #2e2612;
    --note-border: #5e4b1d;
    --code-bg: #111316;
    --hl-keyword: #f28bb7;
    --hl-string: #8fd49c;
    --hl-number: #f3b56b;
    --hl-comment: #9aa1ab;
    --hl-title: #c3a6f5;
    --hl-attr: #82c4f0;
    --header-bg: #1a2a42;
    --header-text: #e8eef7;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: break-word;
}

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

h1, .card h2, .faq > h2, .site-title { font-family: var(--serif); }

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

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
}

/* Header and footer */

.site-header { background: var(--header-bg); }
.site-header .wrap { padding-top: 14px; padding-bottom: 14px; }
.site-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--header-text);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.site-title:hover { color: var(--header-text); }
.site-header :focus-visible { outline-color: var(--header-text); }
.site-mark { flex: none; }

main.wrap { padding-top: 40px; padding-bottom: 48px; }
main:focus { outline: none; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px 0 32px;
}
.site-footer p { margin: 0 0 6px; }

/* Home */

.intro h1 {
  font-size: 2.1rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.intro p { margin: 0 0 20px; color: var(--muted); max-width: 60ch; }

.install {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
}
.install + .install { margin-top: -16px; }
.install summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius);
}
.install summary::-webkit-details-marker { display: none; }
.install summary::after {
  content: "›";
  font-size: 1.4em;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s;
}
.install[open] summary::after { transform: rotate(90deg); }
.install summary:hover { background: var(--accent-soft); }
.install[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.install-body {
  padding: 0 18px 16px;
  display: grid;
  gap: 8px 32px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.install h3 { font-size: 1rem; margin: 6px 0 4px; }
.install ol { margin: 0; padding-left: 1.3em; }
.install li { margin-bottom: 4px; }
.install code {
  font-size: 0.9em;
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

.install-body.stack { display: block; }
.install-body > p { max-width: 70ch; }
.install h4 { font-size: 0.95rem; margin: 14px 0 4px; }
.install .more { margin: 10px 0 0; }
.picker-label { font-weight: 600; margin: 0 0 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.chip:hover { background: var(--accent-soft); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.platform-panel {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}
.platform-panel h3 { margin-top: 10px; }

table.compare { border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.compare th, .compare td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.compare thead th { background: var(--accent-soft); }

.includes { color: var(--muted); font-size: 0.92rem; }
.page-head .includes { margin: 6px 0 0; }

/* Common questions */

.faq { margin-top: 48px; }
.faq > h2 { font-size: 1.35rem; margin: 0 0 14px; }

.link-list { margin: 0; padding-left: 1.1em; }
.link-list li { margin-bottom: 10px; }
.link-list .desc { display: block; color: var(--muted); font-size: 0.92rem; }

/* Skill list toolbar, search, and filters */

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.list-toolbar .result-count { margin: 0 auto 0 0; }
.result-count { color: var(--muted); font-size: 0.95rem; }
.search {
  flex: 1 1 220px;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.search::placeholder { color: var(--muted); }
.view-switch button { display: inline-flex; align-items: center; gap: 6px; }

.filter-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 24px;
  margin: 0 0 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-panel[hidden] { display: none; }
.filter-panel fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.filter-panel legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.check .count { color: var(--muted); font-size: 0.9rem; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}
.active-filters .result-count { margin: 0 6px 0 0; }
.chip-small { min-height: 32px; padding: 4px 12px; font-size: 0.88rem; }
.link-button, .read-more {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  min-height: 24px;
  text-decoration: underline;
  cursor: pointer;
}
.link-button:hover, .read-more:hover { color: var(--accent-hover); }

.empty {
  text-align: center;
  padding: 28px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty p { margin: 0 0 12px; }

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.06);
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.card h2 {
  font-size: 1.15rem;
  margin: 0;
}
.card p { margin: 0 0 14px; }
.card .card-summary { margin-bottom: 4px; }
.read-more { font-size: 0.9rem; margin: 0 0 6px; align-self: flex-start; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 8px; padding: 0; }
.tags li {
  font-size: 0.8rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
}

/* Grid view: compact cards with the summary cut to three lines */

.cards.view-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.view-grid .card { display: flex; flex-direction: column; padding: 16px 18px; }
.view-grid .card h2 { font-size: 1.08rem; }
.view-grid .card-summary:not(.expanded) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.view-grid .card .actions { margin-top: auto; gap: 8px; }
.view-grid .card .btn { padding: 8px 12px; gap: 6px; }

.badge {
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--accent-soft); }
.btn svg { flex: none; }

.size { color: var(--muted); font-size: 0.9rem; }
.card .actions .size { margin-left: auto; }

.status { color: var(--muted); }
.error {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 20px;
}
.error h1 { font-size: 1.3rem; margin: 0 0 8px; }
.error h1:focus { outline: none; }

.btn-small { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; gap: 6px; }
.btn .icon { display: inline-flex; }
.btn.flashed { border-color: var(--accent); }

.sr-only, .offscreen {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Wider layout for file views, so side-by-side has room */

main.wide { max-width: 1240px; }

/* Breadcrumbs */

.crumbs { margin: -6px 0 16px; }
.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  font-size: 0.95rem;
}
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before {
  content: "›";
  color: var(--muted);
  padding: 0 2px;
}
.crumbs a, .crumbs [aria-current] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.crumbs a {
  font-weight: 600;
  text-underline-offset: 3px;
}
.crumbs a:hover { background: var(--accent-soft); }
.crumbs li:first-child a { margin-left: -8px; }
.crumbs [aria-current] { color: var(--muted); }

/* On wider screens the trail stays in view while reading a long file. */
@media (min-width: 768px) {
  .crumbs {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    padding: 6px 0;
    box-shadow: 0 1px 0 var(--border);
  }
}


/* Page heading */

.page-head { margin-bottom: 20px; }
.title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.page-head h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: anywhere;
}
.page-head h1:focus { outline: none; }
.page-head .summary { color: var(--muted); margin: 6px 0 0; max-width: 65ch; }
.page-head .actions { margin-top: 14px; }
.part-of { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }

.note {
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 0.95rem;
}

/* Folder rows */

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rows li + li { border-top: 1px solid var(--border); }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 52px;
  color: var(--text);
  text-decoration: none;
}
.row:hover { background: var(--accent-soft); color: var(--text); }
.row:focus-visible { outline-offset: -3px; }
.row-icon { display: inline-flex; color: var(--muted); }
.row-icon.dir { color: var(--accent); }
.row-icon.file { color: var(--muted); }
.row-text { display: flex; flex-direction: column; min-width: 0; }
.row-name { font-weight: 600; overflow-wrap: anywhere; }
.row:hover .row-name { text-decoration: underline; }
.row-label { color: var(--muted); font-size: 0.9rem; }
.row-size {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.maintainer { margin-top: 24px; }
.maintainer .note { margin-top: 14px; }

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch-track {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--border);
  border: 1px solid var(--muted);
  flex: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--muted);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* File view */

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}
.toolbar-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.segmented {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.segmented button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.segmented button:focus-visible { outline-offset: -3px; }

.manual-copy {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  font: 0.9rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 8px 10px;
}
.actions > .manual-copy { flex-basis: 100%; margin: 0; }

.file-content { display: grid; gap: 16px; }
.file-content.mode-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pane {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mode-split .pane { max-height: 78vh; overflow: auto; }
.mode-formatted .pane { padding: 4px 28px 20px; }
.mode-split .pane:first-child { padding: 4px 22px 20px; }
.mode-formatted .md-body { max-width: 75ch; }

@media (max-width: 767.98px) {
  .file-content.mode-split { grid-template-columns: minmax(0, 1fr); }
  .mode-split .pane { max-height: 65vh; }
  .mode-formatted .pane, .mode-split .pane:first-child { padding: 2px 16px 16px; }
  .segmented button { padding: 8px 10px; }
}

pre.raw {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  font: 0.875rem/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  tab-size: 4;
}
pre.raw.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.raw:focus-visible { outline-offset: -3px; }

.binary-card {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.binary-card > div { min-width: 0; flex: 1 1 220px; }
.row-icon.big svg { width: 40px; height: 40px; }
.binary-name { font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.binary-card .size { margin: 2px 0 14px; }

/* Formatted Markdown */

.md-body { overflow-wrap: break-word; }
/* Markdown headings are one level down (the file name is the page's h1). */
.md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 { line-height: 1.3; margin: 1.4em 0 0.5em; scroll-margin-top: 12px; }
.md-body h2 { font-size: 1.5rem; }
.md-body h3 { font-size: 1.25rem; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.md-body h4 { font-size: 1.08rem; }
.md-body h5, .md-body h6 { font-size: 1rem; }
.md-body p, .md-body ul, .md-body ol, .md-body blockquote { margin: 0 0 0.9em; }
.md-body li { margin-bottom: 0.25em; }
.md-body li > ul, .md-body li > ol { margin: 0.25em 0 0; }
.md-body blockquote {
  border-left: 4px solid var(--border);
  padding: 2px 14px;
  color: var(--muted);
}
.md-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.md-body img { max-width: 100%; height: auto; }
.md-body :not(pre) > code {
  font: 0.88em ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.md-body table { border-collapse: collapse; font-size: 0.95rem; }
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.md-body th { background: var(--code-bg); }

.code-block {
  position: relative;
  margin: 0 0 1em;
}
.code-block pre {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 44px 14px 12px;
  overflow: auto;
  font: 0.86rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.code-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--surface);
}

.frontmatter {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 18px 0 8px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 0.95rem;
}
.frontmatter dt { font-weight: 700; }
.frontmatter dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .frontmatter { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .frontmatter dd { margin-bottom: 8px; }
}

/* Syntax colors (highlight.js class names) */

.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-literal, .hljs-type { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-variable, .hljs-template-variable { color: var(--hl-number); }
.hljs-comment, .hljs-quote, .hljs-deletion, .hljs-meta { color: var(--hl-comment); }
.hljs-title, .hljs-section, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: var(--hl-title); font-weight: 600; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-params, .hljs-link { color: var(--hl-attr); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .switch-track::after, .install summary::after, .card { transition: none; }
}

/* Headings clear the sticky breadcrumb trail when a link jumps to them. */
@media (min-width: 768px) {
  .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 { scroll-margin-top: 64px; }
}
