/* qcode's website.
   The tones below are the ones the editor draws itself with — see
   internal/ui/theme.go in the qcode repository. Nothing here loads from another
   host: no fonts, no scripts, no images beyond assets/. */

/* ── tokens ─────────────────────────────────────────────────────────────── */

:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* light: the editor's day appearance */
  --bg: #ffffff;
  --pane: #f4f4f5;
  --shell: #ececef;
  --line: #dcdce2;
  --hover: #e4e4e8;
  --text: #18181b;
  --muted: #5b5b66;
  --accent: #4c9aff;
  --accent-ink: #08121f;
  --accent-hover: #2f86f6;
  --shadow: 0 1px 2px rgba(24, 24, 27, .06), 0 30px 60px -34px rgba(24, 24, 27, .35);

  --wrap: 1200px;
  --pad: 32px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181b;
    --pane: #202024;
    --shell: #27272a;
    --line: #3a3a42;
    --hover: #323236;
    --text: #f5f7fb;
    --muted: #9a9aa6;
    --accent-hover: #6bafff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 40px 80px -40px rgba(0, 0, 0, .8);
  }
}

html[data-theme="light"] {
  --bg: #ffffff;
  --pane: #f4f4f5;
  --shell: #ececef;
  --line: #dcdce2;
  --hover: #e4e4e8;
  --text: #18181b;
  --muted: #5b5b66;
  --accent-hover: #2f86f6;
  --shadow: 0 1px 2px rgba(24, 24, 27, .06), 0 30px 60px -34px rgba(24, 24, 27, .35);
}

html[data-theme="dark"] {
  --bg: #18181b;
  --pane: #202024;
  --shell: #27272a;
  --line: #3a3a42;
  --hover: #323236;
  --text: #f5f7fb;
  --muted: #9a9aa6;
  --accent-hover: #6bafff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 40px 80px -40px rgba(0, 0, 0, .8);
}

/* ── base ───────────────────────────────────────────────────────────────── */

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

html {
  background: var(--bg);
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The top bar is sticky: a jump to a section must not land under it. */
[id] { scroll-margin-top: 76px; }

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

a { color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

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

code {
  font-family: var(--mono);
  font-size: .88em;
  color: var(--text);
  background: var(--shell);
  border-radius: 2px;
  padding: .08em .34em;
}

/* ── language ───────────────────────────────────────────────────────────── */

html[data-lang="en"] [data-lang="zh"] { display: none; }
html[data-lang="zh"] [data-lang="en"] { display: none; }

/* ── layout ─────────────────────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

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

.skip {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 100;
  transform: translateY(-200%);
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  font: 12px/1 var(--mono);
  text-decoration: none;
  border-radius: 3px;
}
.skip:focus { transform: none; }

/* ── top bar ────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--shell);
}

.topbar__in {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}

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

.brand__mark {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--text);
}

.brand__name {
  font: 600 14px/1 var(--mono);
  letter-spacing: -.01em;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav a {
  font: 11.5px/1 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
}
.nav a:hover { color: var(--text); }

.controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.seg__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 11px/1 var(--mono);
  letter-spacing: .05em;
  padding: 0 9px;
  height: 28px;
  cursor: pointer;
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-pressed="true"] {
  background: var(--hover);
  color: var(--text);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg {
  width: 15px; height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  .icon-sun { display: none; }
  .icon-moon { display: block; }
}
html[data-theme="light"] .icon-sun { display: block; }
html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

/* ── hero ───────────────────────────────────────────────────────────────── */

.hero {
  padding-block: 72px 60px;
  background: var(--bg);
}

.hero__text {
  max-width: 64ch;
}

.eyebrow {
  margin: 0 0 20px;
  font: 11.5px/1.5 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.15rem, 4.2vw, 3.35rem);
  line-height: 1.06;
  letter-spacing: -.032em;
  font-weight: 600;
  text-wrap: balance;
}

.cursor {
  display: inline-block;
  width: .085em;
  height: .8em;
  margin-left: .12em;
  background: var(--accent);
  vertical-align: -.02em;
}

.lede {
  margin: 22px 0 0;
  max-width: 44ch;
  font-size: 1.0625rem;
  line-height: 1.62;
  color: var(--muted);
  text-wrap: pretty;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--shell);
  color: var(--text);
  font: 12.5px/1 var(--mono);
  letter-spacing: .02em;
  text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--hover); border-color: var(--muted); }

.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}
.btn--primary:hover { background: var(--accent-hover); border-color: transparent; }

.meta {
  margin: 18px 0 0;
  font: 11.5px/1.6 var(--mono);
  letter-spacing: .02em;
  color: var(--muted);
}

/* ── screenshots ────────────────────────────────────────────────────────── */

.shot {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--pane);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.shot img { width: 100%; }

.shot figcaption {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--shell);
  color: var(--muted);
  font: 11.5px/1.6 var(--mono);
}
.shot figcaption code { background: transparent; padding: 0; color: var(--text); }

.shot--hero {
  margin-top: 48px;
}

.shot--wide { margin-top: 36px; }

/* ── numbers ────────────────────────────────────────────────────────────── */

.numbers {
  background: var(--pane);
  border-block: 1px solid var(--line);
}

.numbers__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
}

.num {
  background: var(--pane);
  padding: 26px 22px 28px;
}

.num b {
  display: block;
  font: 600 clamp(1.45rem, 2.4vw, 1.95rem)/1 var(--mono);
  letter-spacing: -.025em;
  color: var(--text);
}

.num span {
  display: block;
  margin-top: 10px;
  max-width: 26ch;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ── sections ───────────────────────────────────────────────────────────── */

.section {
  padding-block: 84px;
  border-top: 1px solid var(--line);
}
.section:first-of-type { border-top: 0; }

.section--shell { background: var(--shell); }
.section--pane { background: var(--pane); }

.section__head {
  max-width: 64ch;
  margin-bottom: 44px;
}

.section__head .eyebrow { margin-bottom: 16px; }

.section h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2.8vw, 2.05rem);
  line-height: 1.2;
  letter-spacing: -.025em;
  font-weight: 600;
  text-wrap: balance;
}

.section__lede {
  margin: 14px 0 0;
  max-width: 58ch;
  font-size: .9375rem;
  line-height: 1.62;
  color: var(--muted);
  text-wrap: pretty;
}

/* ── features ───────────────────────────────────────────────────────────── */

.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  counter-reset: feat;
}

.features li {
  counter-increment: feat;
  background: var(--bg);
  padding: 24px 24px 26px;
}

.features li::before {
  content: counter(feat, decimal-leading-zero);
  display: block;
  margin-bottom: 14px;
  font: 11px/1 var(--mono);
  letter-spacing: .1em;
  color: var(--muted);
}

.features h3,
.refusals h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.005em;
}

.features p,
.refusals p {
  margin: 0;
  font-size: .875rem;
  line-height: 1.62;
  color: var(--muted);
  text-wrap: pretty;
}

/* ── refusals ───────────────────────────────────────────────────────────── */

.refusals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.refusals li {
  background: var(--shell);
  padding: 24px 24px 26px;
}

.refusals h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.refusals h3::before {
  content: "×";
  font: 13px/1 var(--mono);
  color: var(--accent);
}

/* ── download ───────────────────────────────────────────────────────────── */

.downloads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.dl {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-top: 2px solid var(--line);
  border-radius: 3px;
}

/* The platform you are on gets the accent line the active tab carries. */
.dl.is-current { border-top-color: var(--accent); }

.dl__plat {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.dl__note {
  margin: 0;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.dl__files {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 2px 0 6px;
}

.dl__files code {
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--muted);
  background: var(--pane);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px 6px;
}

.dl .btn { margin-top: auto; }

/* Only the platform this visit is on gets a filled button — the rest stay quiet. */
.dl .btn {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  font-weight: 500;
}
.dl .btn:hover { background: var(--hover); border-color: var(--muted); }
.dl.is-current .btn {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}
.dl.is-current .btn:hover { background: var(--accent-hover); border-color: transparent; }

.download__foot {
  margin-top: 40px;
  max-width: 74ch;
}
.download__foot > p {
  margin: 0;
  font-size: .875rem;
  line-height: 1.65;
  color: var(--muted);
  text-wrap: pretty;
}
.download__foot .eyebrow { margin: 32px 0 10px; }

.code {
  margin: 0;
  padding: 16px 18px;
  background: var(--shell);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow-x: auto;
  font: 12.5px/1.8 var(--mono);
  color: var(--text);
}
.code code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.code__prompt { color: var(--accent); }

.download__more { margin-top: 26px !important; }
.download__more a {
  font: 12.5px/1 var(--mono);
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.download__more a:hover { text-decoration-color: var(--accent); }

/* ── footer ─────────────────────────────────────────────────────────────── */

.footer {
  background: var(--shell);
  border-top: 1px solid var(--line);
  padding-block: 26px;
}

.footer__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  font: 11.5px/1.6 var(--mono);
  color: var(--muted);
}

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

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.footer__nav a {
  color: var(--muted);
  text-decoration: none;
}
.footer__nav a:hover { color: var(--text); }

.footer__note {
  margin: 0 0 0 auto;
  max-width: 46ch;
  text-wrap: pretty;
}

/* ── narrow ─────────────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .numbers__grid { grid-template-columns: repeat(2, 1fr); }
  .downloads { grid-template-columns: 1fr; }
  .footer__note { margin-left: 0; flex-basis: 100%; }
}

@media (max-width: 720px) {
  :root { --pad: 20px; }

  .nav { display: none; }

  .hero { padding-block: 52px 44px; }
  .section { padding-block: 60px; }

  .hero h1 { font-size: 2.05rem; }
  .lede { font-size: 1rem; }
  .shot--hero { margin-top: 36px; }

  .features { grid-template-columns: 1fr; }
  .refusals { grid-template-columns: 1fr; }
  .numbers__grid { grid-template-columns: 1fr; }

  .num { padding: 22px 20px 24px; }

  .footer__in { flex-direction: column; align-items: flex-start; }
}
