/* The Markstage site. Plain CSS, no build step; light and dark follow the visitor's system setting.
   Look: "bold and fresh" (scripts/site/brand.mjs): volt lime on ink, a soft green-grey for surfaces, pink as the
   second accent, 30px cards and pill buttons. Every text colour pair passes WCAG AA (4.5:1), and the mark 3:1
   against the page, in both themes (scripts/site/brand.test.mjs checks). Text is sentence case everywhere: no
   capitals-only headings, labels or buttons. Headings and the wordmark use Bricolage Grotesque, text Figtree (both
   SIL Open Font License, site/fonts/). home.css adds the home, features, AI, story and showcase parts. */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage-grotesque-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: url('fonts/figtree.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f2f6e6;
  --surface: #ffffff;
  --line: #e3e8d6;
  --line-2: #c9d1b8;
  --ink: #0e1a0b;
  --ink-2: #2f3a2a;
  --ink-3: #4c5446;
  --brand: #cdf75a;
  --brand-hover: #bdea3c;
  --brand-ink: #3a5f00;
  --on-brand: #0e1a0b;
  --on-brand-2: #2f3a2a;
  --brand-soft: #f2f6e6;
  --accent: #ffb4e4;
  --on-accent: #0e1a0b;
  --btn-ink: #0e1a0b;
  --on-btn-ink: #ffffff;
  --band: #0e1a0b;
  --band-soft: #1c2a18;
  --band-ink: #f4f8ea;
  --band-ink-2: #c9d3bd;
  --logo-tile: #0e1a0b;
  --logo-glyph: #cdf75a;
  --ok: #1a7f45;
  --code-bg: #f2f6e6;
  /* the comparison's mark badges (site/compare.css) and Markstage's highlighted column */
  --yes-ink: #1d5c10;
  --yes-bg: #e4f5c4;
  --part-ink: #6b4500;
  --part-bg: #fbefc9;
  --no-ink: #9b1747;
  --no-bg: #ffe6f4;
  --unk-ink: #4c5446;
  --unk-bg: #edf1e3;
  --ms-col: #f5fbe2;
  --shadow: 0 1px 2px rgb(14 26 11 / 6%), 0 18px 48px -18px rgb(14 26 11 / 26%);
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', 'Arial Black', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-card: 30px;
  --pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1a0b;
    --bg-2: #142211;
    --surface: #1c2a18;
    --line: #2c3b26;
    --line-2: #46583c;
    --ink: #f4f8ea;
    --ink-2: #d3dcc8;
    --ink-3: #b7c2ab;
    --brand: #cdf75a;
    --brand-hover: #dcfb85;
    --brand-ink: #cdf75a;
    --on-brand: #0e1a0b;
    --on-brand-2: #2f3a2a;
    --brand-soft: #22341a;
    --accent: #ffb4e4;
    --on-accent: #0e1a0b;
    --btn-ink: #f4f8ea;
    --on-btn-ink: #0e1a0b;
    --band: #172612;
    --band-soft: #22341a;
    --band-ink: #f4f8ea;
    --band-ink-2: #c9d3bd;
    --logo-tile: #cdf75a;
    --logo-glyph: #0e1a0b;
    --ok: #86e0a0;
    --code-bg: #1c2a18;
    --yes-ink: #cdf75a;
    --yes-bg: #24391a;
    --part-ink: #fcd38a;
    --part-bg: #3a2e0e;
    --no-ink: #ffb4e4;
    --no-bg: #3c1a30;
    --unk-ink: #c9d3bd;
    --unk-bg: #26331f;
    --ms-col: #1d2f15;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 18px 48px -18px rgb(0 0 0 / 60%);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* the sticky top bar (76px) and a gap, so anchors and page changes clear it */
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
}

a {
  color: var(--brand-ink);
  text-underline-offset: 2px;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  border-radius: 5px;
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  overflow-wrap: normal;
}

kbd {
  font-family: var(--mono);
  font-size: 0.85em;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 0.35em;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1,
h2 {
  line-height: 1.04;
  letter-spacing: -0.035em;
}

h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.4rem);
  margin: 0 0 16px;
}

h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.9rem);
  margin: 48px 0 12px;
}

h3 {
  font-size: 1.22rem;
  margin: 24px 0 8px;
}

/* the lime highlight behind a few words of a heading */
.mark {
  background: var(--brand);
  color: var(--on-brand);
  border-radius: 0.18em;
  padding: 0 0.12em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.wrap.wide {
  max-width: 1280px;
}

.small {
  font-size: 15px;
}

.muted {
  color: var(--ink-3);
}

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

.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 20;
  background: var(--surface);
  padding: 8px 12px;
}

/* Top bar: the mark, the name with the tagline under it, the links and the GitHub pill */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 16px 28px;
}

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

.brand:hover {
  color: var(--ink);
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.brand-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

.logo {
  flex: none;
}

.logo .lt {
  fill: var(--logo-tile);
}

.logo .ls {
  stroke: var(--logo-glyph);
}

.logo .lc {
  fill: var(--logo-glyph);
}

/* the caret blinks like a text cursor, only where the visitor allows motion; files and images stay still */
@media (prefers-reduced-motion: no-preference) {
  .logo .lc {
    animation: caret-blink 1.1s steps(1) infinite;
  }

  @keyframes caret-blink {
    50% {
      opacity: 0;
    }
  }
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}

.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.97rem;
  font-weight: 600;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

/* GitHub, always in view: the ink pill with a star, "Star on GitHub" and the live star count (enhance.js) */
.topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 10px 9px 16px;
  border-radius: var(--pill);
  background: var(--btn-ink);
  color: var(--on-btn-ink);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.gh-btn:hover {
  color: var(--on-btn-ink);
  box-shadow: 0 0 0 3px var(--brand);
}

.gh-count {
  min-width: 28px;
  padding: 1px 8px;
  border-radius: var(--pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.gh-count:empty {
  display: none;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  color: var(--ink);
  padding: 8px;
}

.lead {
  font-size: 1.18rem;
  color: var(--ink-3);
  max-width: 760px;
  margin: 0 auto 28px;
}

.lead.left {
  margin-left: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 24px 0;
}

.cta-row.left {
  justify-content: flex-start;
}

/* Buttons: pills. Lime for the main action, ink for the second, a line for the rest */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: var(--pill);
  padding: 13px 22px;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  border: 0;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
  color: var(--on-brand);
}

.btn-ink {
  background: var(--btn-ink);
  color: var(--on-btn-ink);
}

.btn-ink:hover {
  color: var(--on-btn-ink);
  box-shadow: 0 0 0 3px var(--brand);
}

.btn-secondary {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--line-2);
}

.btn-secondary:hover {
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.btn-text {
  color: var(--brand-ink);
  padding-left: 8px;
  padding-right: 8px;
}

/* Screenshots: light frames in both themes, so the editor's light UI never sits dark on dark */
.shot {
  margin: 24px 0;
}

.shot img {
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  background: #fff;
}

.shot figcaption {
  font-size: 14px;
  color: var(--ink-3);
  margin-top: 8px;
}

/* Sections */

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

.cards.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  counter-reset: step;
}

.card {
  background: var(--bg-2);
  border: 0;
  border-radius: var(--radius-card);
  padding: 24px;
}

.card h2,
.card h3 {
  margin-top: 0;
  font-size: 19px;
}

.card p {
  margin-bottom: 0;
  color: var(--ink-2);
}

.cards.four .card::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 700;
  margin-bottom: 10px;
}

.cmd {
  margin: 8px 0;
}

.cmd .copyable {
  width: 100%;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 6px 6px 12px;
}

.cmd .copyable-value {
  flex: 1;
  background: none;
  padding: 0;
  font-size: 13.5px;
}

/* FAQ */
.faq {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 40px;
}

.qa h3 {
  font-size: 18px;
}

.qa p {
  color: var(--ink-2);
  margin-top: 0;
}

/* The copy / open helper: icons show on hover or focus, always on touch screens. */
.copyable {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.copyable-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.icon-btn .icon {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.copyable:hover .icon-btn,
.copyable:focus-within .icon-btn,
.icon-btn.copied {
  opacity: 1;
}

.icon-btn.copied {
  color: var(--ok);
}

@media (hover: none) {
  .icon-btn {
    opacity: 1;
  }
}

/* Docs and long pages */
.doc {
  max-width: 820px;
  padding-top: 24px;
  padding-bottom: 48px;
}

.doc.wide {
  max-width: 1040px;
}

.doc-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.doc-layout .doc {
  max-width: 860px;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}

.docs-nav {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding: 24px 0;
  font-size: 15px;
}

.docs-nav ul,
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.docs-nav li {
  margin: 4px 0;
}

.docs-nav a {
  color: var(--ink-2);
  text-decoration: none;
}

.docs-nav a[aria-current='page'] {
  color: var(--brand-ink);
  font-weight: 600;
}

.docs-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  margin: 0 0 8px;
}

.toc {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px 4px;
  margin: 16px 0 24px;
  font-size: 15px;
}

.toc li {
  margin: 4px 0;
}

.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--ink-3);
}

.crumbs li + li::before {
  content: '/';
  margin-right: 6px;
}

.prose h2 {
  font-size: 28px;
  margin-top: 40px;
}

.prose h3 {
  font-size: 21px;
}

.prose h4,
.prose h5,
.prose h6 {
  font-size: 18px;
}

.prose li + li {
  margin-top: 4px;
}

.prose blockquote {
  margin: 16px 0;
  padding: 4px 18px;
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 8px 8px 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

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

thead th {
  background: var(--bg-2);
  font-weight: 650;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.center,
th.center {
  text-align: center;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.pager a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  font-weight: 600;
}

.pager .next {
  text-align: right;
}

.link-list {
  columns: 2;
}

.term h2,
.term h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.term p {
  margin-top: 0;
  color: var(--ink-2);
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  margin-top: 48px;
  font-size: 15px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 24px;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.footer-cols a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  margin: 6px 0;
}

.footer-cols a:hover {
  color: var(--brand-ink);
}

.footer-head {
  font-weight: 700;
  margin: 0 0 8px;
}

.footer-row {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 16px;
  padding-bottom: 24px;
}

/* Narrow windows */
@media (max-width: 900px) {
  .doc-layout,
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-nav {
    position: static;
    max-height: none;
    padding-bottom: 0;
  }

  .cards.three,
  .cards.four,
  .faq {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* the menu folds into a button before the links would crowd the GitHub button */
@media (max-width: 1120px) {
  .topbar-end {
    margin-left: auto;
  }

  .menu-btn {
    display: inline-grid;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 12px 20px 20px;
  }

  .main-nav.open {
    display: flex;
  }
}

@media (max-width: 640px) {
  .gh-long {
    display: none;
  }

  .cards.two,
  .footer-cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .link-list {
    columns: 1;
  }
}

/* A code block with the shared copy icon (enhance.js) */
.copyable.code-block {
  display: block;
  position: relative;
}

.code-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
}

/* the full comparison: wide tables keep their first column in view; source numbers link to the list at the end */
.comparison table {
  font-size: 14px;
  line-height: 1.45;
}

.comparison tbody td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg);
  font-weight: 600;
  min-width: 150px;
}

sup.fn a {
  margin-left: 2px;
  font-size: 0.75em;
  text-decoration: none;
}

ol.sources {
  font-size: 14px;
  columns: 2 320px;
  column-gap: 32px;
}

ol.sources li {
  break-inside: avoid;
  margin-bottom: 4px;
}
