/* The public part of the site (part B of M6): text of the content, documentation, lessons, downloads.
   Tokens come from site.css; only the colours of callouts, code and search marks are added here. */
:root {
  --code-bg: #eef1f4;
  --important-bg: #fff6e3;
  --important-line: #d99a00;
  --tip-bg: #e9f6ee;
  --tip-line: #2f9e5b;
  --mark: #ffec99;
  --shadow: 0 6px 24px rgb(16 24 40 / 12%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --code-bg: #242a32;
    --important-bg: #2e2715;
    --important-line: #d9a23a;
    --tip-bg: #16281e;
    --tip-line: #4cc27f;
    --mark: #5c4c10;
    --shadow: 0 6px 24px rgb(0 0 0 / 45%);
  }
}

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

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.align-left { text-align: left; }
.align-center { text-align: center; }
.align-right { text-align: right; }

.notice {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
}

/* Buttons */
.button,
.button-secondary {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
}
.button { background: var(--accent); color: #fff; }
.button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.button-secondary { background: transparent; color: var(--accent); }
.button-secondary:hover { background: var(--panel); }
@media (prefers-color-scheme: dark) {
  .button, .button:hover { color: #0d1117; }
}

/* Home */
.hero { margin-bottom: 40px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}
.card {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.steps { padding-left: 22px; }
.steps li { margin: 6px 0; }

/* Text of the content */
.page { max-width: 760px; }
.prose { overflow-wrap: break-word; }
.prose h2 { margin: 32px 0 10px; font-size: 24px; }
.prose h3 { margin: 24px 0 8px; font-size: 19px; }
.prose h4 { margin: 20px 0 6px; font-size: 16px; }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: 16px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.heading-anchor {
  margin-left: 6px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}
h2:hover .heading-anchor, h3:hover .heading-anchor, h4:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }

code, pre { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: 0.92em; }
:not(pre) > code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); }
pre {
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 6px;
  background: var(--code-bg);
  line-height: 1.45;
}
.action-ref { text-decoration: none; }
.action-ref:hover code { text-decoration: underline; }

blockquote {
  margin: 16px 0;
  padding: 2px 16px;
  border-left: 4px solid var(--line);
  color: var(--muted);
}

.callout {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--important-line);
  border-radius: 6px;
  background: var(--important-bg);
}
.callout > :last-child { margin-bottom: 4px; }
.callout-tip { border-left-color: var(--tip-line); background: var(--tip-bg); }
.callout-title { margin: 2px 0 6px; font-weight: 700; }

.table-wrap { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; min-width: 50%; }
th, td { padding: 7px 10px; border: 1px solid var(--line); vertical-align: top; text-align: left; }
th { background: var(--panel); font-weight: 600; }
th.align-right, td.align-right { text-align: right; }
th.align-center, td.align-center { text-align: center; }

figure.screenshot { margin: 20px 0; }
figure.screenshot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
figure.screenshot figcaption { margin-top: 6px; color: var(--muted); font-size: 14px; }
.screenshot-inline { max-height: 1.6em; vertical-align: middle; }

/* Documentation */
.docs {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  font-size: 15px;
}
.docs-article { min-width: 0; }
.docs-article h1 { margin: 4px 0 16px; font-size: 32px; }
.docs-crumbs { margin: 0; color: var(--muted); font-size: 14px; }
.docs-crumbs a { color: var(--muted); }

.version-switcher { position: relative; margin-bottom: 12px; }
.version-switcher summary {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
}
.version-switcher ul {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 6px 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.version-switcher li a { display: block; padding: 5px 12px; text-decoration: none; color: var(--ink); }
.version-switcher li a:hover { background: var(--bg); }
.version-switcher li a.current { font-weight: 600; color: var(--accent); }

.docs-search { position: relative; display: flex; gap: 6px; margin-bottom: 16px; }
.docs-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.docs-search button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.search-results {
  position: absolute;
  z-index: 6;
  top: 100%;
  left: 0;
  /* As wide as the search box: the sticky sidebar clips anything wider (a horizontal scrollbar). */
  width: 100%;
  max-height: 60vh;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.search-results a { display: block; padding: 7px 12px; color: var(--ink); text-decoration: none; }
.search-results a:hover, .search-results a:focus, .search-results a.active { background: var(--bg); }
.search-results .search-title { display: block; font-weight: 600; }
.search-results .search-snippet { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.search-results .search-empty { padding: 7px 12px; color: var(--muted); }
mark { background: var(--mark); color: inherit; border-radius: 2px; }
.search-page-results li { margin: 14px 0; }
.search-page-results p { margin: 4px 0 0; color: var(--muted); }

.docs-nav ul { margin: 0; padding: 0; list-style: none; }
.docs-nav ul ul { margin: 2px 0 6px 12px; padding-left: 8px; border-left: 1px solid var(--line); }
.docs-nav a, .docs-nav span { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; }
.docs-nav .nav-section > a, .docs-nav .nav-section > span { color: var(--ink); font-weight: 600; margin-top: 6px; }
.docs-nav a:hover { color: var(--ink); }
.docs-nav a.current { color: var(--accent); font-weight: 600; }

.docs-outline {
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: 15px;
}
.docs-outline-title { margin: 0 0 4px; font-weight: 600; }
.docs-outline ul { margin: 0; padding-left: 18px; }
.docs-outline .level-3 { margin-left: 14px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; max-width: 48%; text-decoration: none; }
.pager span { color: var(--muted); font-size: 13px; }
.pager-next { margin-left: auto; text-align: right; }

/* Downloads */
.release { margin: 24px 0 32px; }
.release h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.release-files td { font-size: 15px; }
.sha { margin-top: 4px; color: var(--muted); font-size: 12px; }
.sha code { word-break: break-all; background: transparent; padding: 0; }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}
.badge-stable { background: var(--tip-bg); color: var(--tip-line); }
.badge-preview { background: var(--important-bg); color: var(--important-line); }
.preview-note { margin-top: 32px; }

/* Lessons */
.lesson-list { display: grid; gap: 12px; padding: 0; list-style: none; counter-reset: lesson; }
.lesson-list li { counter-increment: lesson; }
.lesson-card {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.lesson-card:hover { border-color: var(--accent); color: var(--ink); }
.lesson-title { font-size: 18px; font-weight: 600; }
.lesson-title::before { content: counter(lesson) ". "; color: var(--muted); }
.lesson-description { color: var(--muted); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--muted); }
.lesson-facts { display: grid; gap: 6px; margin: 0 0 20px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.lesson-facts div { display: flex; gap: 8px; }
.lesson-facts dt { min-width: 64px; font-weight: 600; }
.lesson-facts dd { margin: 0; }
.lesson-files h2 { font-size: 19px; margin: 0 0 6px; }
.lesson-files ul { margin: 0 0 16px; padding-left: 20px; }

.changelog-version { margin: 20px 0 28px; }
.changelog-version h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.changelog-version > .muted { margin-top: 2px; }

@media (max-width: 760px) {
  .docs { grid-template-columns: 1fr; gap: 16px; }
  .docs-sidebar { position: static; max-height: none; overflow: visible; }
  .docs-article h1 { font-size: 26px; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
  .pager-next { margin-left: 0; text-align: left; }
}
