/* Chatdown: paper and ink. The demo window is the product; everything else stays quiet around it. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --well: #efeee9;
  --ink: #17181b;
  --ink-2: #45464c;
  --ink-3: #6a6b72;
  --rule: rgba(20, 20, 30, 0.1);
  --rule-strong: rgba(20, 20, 30, 0.18);
  --accent: #0a66e0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 102, 224, 0.1);
  --mine: #efeee9;
  --code-bg: #fbfaf7;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 30px 70px -30px rgba(30, 30, 60, 0.35), 0 6px 18px -8px rgba(30, 30, 60, 0.14);

  --max: 1180px;
  --pad: clamp(16px, 4vw, 40px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.3, 0.7, 0.2, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1b1c1f;
    --well: #222327;
    --ink: #eeeef0;
    --ink-2: #b9bac0;
    --ink-3: #8e8f97;
    --rule: rgba(255, 255, 255, 0.09);
    --rule-strong: rgba(255, 255, 255, 0.16);
    --accent: #3d8bff;
    --accent-ink: #0b1020;
    --accent-soft: rgba(61, 139, 255, 0.16);
    --mine: #26272b;
    --code-bg: #16171a;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 40px 80px -30px rgba(0, 0, 0, 0.75);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font: 0.88em var(--mono); background: var(--well); padding: 0.1em 0.35em; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.025em; line-height: 1.1; margin: 0; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 650; letter-spacing: -0.012em; }
p { margin: 0; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.narrow { max-width: 780px; }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 100;
}
.skip:focus { left: 8px; }

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

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--ink); text-decoration: none; letter-spacing: -0.015em; }
.brand img { border-radius: 5px; }
.nav ul { list-style: none; display: flex; gap: clamp(10px, 2.4vw, 26px); margin: 0; padding: 0; font-size: 15px; }
.nav a:not(.brand) { color: var(--ink-2); text-decoration: none; }
.nav a:not(.brand):hover { color: var(--ink); }
.nav .gh { color: var(--ink) !important; font-weight: 550; }
@media (max-width: 640px) {
  .nav li:not(:last-child):not(:nth-child(3)) { display: none; }
}

/* ---------- hero ---------- */

.hero { padding: clamp(56px, 11vw, 132px) 0 clamp(40px, 6vw, 64px); text-align: center; }
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 550; color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: 4px 12px; margin-bottom: 26px;
}
.hero h1 { font-size: clamp(2.6rem, 7.4vw, 5.2rem); font-weight: 750; letter-spacing: -0.045em; line-height: 1.02; }
.hero .md {
  font-family: var(--mono); font-weight: 600; letter-spacing: -0.06em; color: var(--accent);
  position: relative; white-space: nowrap;
}
.hero .md::before { content: "**"; opacity: 0.35; font-weight: 400; }
.hero .md::after { content: "**"; opacity: 0.35; font-weight: 400; }
.lede { max-width: 640px; margin: 26px auto 0; font-size: clamp(1.04rem, 1.6vw, 1.2rem); color: var(--ink-2); }
.lede code { font-size: 0.85em; }

.ctas { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 34px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 16px/1 var(--font); letter-spacing: -0.01em;
  padding: 14px 20px; border-radius: 10px; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn svg { width: 17px; height: 17px; }

.sites { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 34px 0 0; }
.sites li {
  font-size: 14px; color: var(--ink-2); padding: 5px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--rule);
}

/* ---------- sections ---------- */

section { padding: clamp(56px, 9vw, 104px) 0; }
.section-head { max-width: 720px; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head p { margin-top: 14px; color: var(--ink-2); font-size: 1.06rem; }

/* ---------- demo ---------- */

.demo-section { padding-top: 8px; }
.demo-section .section-head { margin-left: auto; margin-right: auto; text-align: center; }

.window {
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden;
}
.window-bar {
  display: flex; align-items: center; gap: 16px; padding: 10px 14px;
  border-bottom: 1px solid var(--rule); background: var(--well);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--rule-strong); }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs button {
  font: 550 13px var(--font); color: var(--ink-2); background: none; border: 0;
  padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--rule-strong); }

.window-body { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); height: 620px; }
@media (max-width: 860px) {
  .window-body { grid-template-columns: minmax(0, 1fr); height: auto; }
  .panel { border-right: 0 !important; border-bottom: 1px solid var(--rule); max-height: 560px; }
  .md-out { height: 460px; }
}

.panel { display: flex; flex-direction: column; border-right: 1px solid var(--rule); min-height: 0; font-size: 13px; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.panel-head strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--ink-3); white-space: nowrap; }
.panel-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 10px; flex-wrap: wrap; }
.seg { display: flex; }
.seg button {
  font: 12px var(--font); color: var(--ink); background: var(--well); cursor: pointer;
  border: 1px solid var(--rule-strong); padding: 4px 9px; margin-left: -1px;
}
.seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button:hover { background: var(--surface); }
.count { color: var(--ink-3); font-size: 12px; }

.turns { list-style: none; margin: 0; padding: 0 14px 10px; display: flex; flex-direction: column; gap: 6px; overflow: auto; flex: 1; min-height: 0; }
.turn {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; padding: 8px 10px;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--surface); cursor: pointer; user-select: none;
  transition: opacity 0.15s, background 0.15s;
}
.turn.user { background: var(--mine); border-color: transparent; }
.turn.off { opacity: 0.45; }
.turn:hover { border-color: var(--rule-strong); }
.turn input { margin: 2px 0 0; accent-color: var(--accent); pointer-events: none; }
.turn .meta { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--ink-3); flex-wrap: wrap; }
.turn .role { font-weight: 650; color: var(--ink); }
.turn .chip { border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0 6px; }
.turn .snippet {
  grid-column: 2; color: var(--ink); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}

.opts {
  display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 6px 16px;
  margin: 0; padding: 10px 14px 14px; border: 0; border-top: 1px solid var(--rule); font-size: 12.5px;
}
.opts legend { float: left; width: 100%; grid-column: 1 / -1; padding: 0; margin-bottom: 2px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.opts label { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.opts input { accent-color: var(--accent); margin: 0; }
@media (max-width: 420px) { .opts { grid-template-columns: repeat(2, auto); } }

.output { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--code-bg); }
.output-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.file { font: 600 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stats { color: var(--ink-3); font-size: 12px; margin-right: auto; white-space: nowrap; }
@media (max-width: 520px) { .stats { display: none; } .file { margin-right: auto; } }
.mini {
  font: 550 12px var(--font); color: var(--ink); background: var(--surface); cursor: pointer;
  border: 1px solid var(--rule-strong); border-radius: 6px; padding: 4px 10px;
}
.mini:hover { border-color: var(--ink-3); }
.fmt { display: flex; }
.fmt button {
  font: 550 12px var(--font); color: var(--ink-2); background: none; cursor: pointer;
  border: 1px solid var(--rule-strong); padding: 3px 8px; margin-left: -1px;
}
.fmt button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.fmt button:last-child { border-radius: 0 6px 6px 0; }
.fmt button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.html-out { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
@media (max-width: 860px) { .html-out { height: 460px; flex: none; } }
@media (max-width: 640px) { .output-head .file { display: none; } .output-head .fmt { margin-right: auto; } }
@media (max-width: 1180px) { .stats { display: none; } .file { margin-right: auto; } }
.md-out {
  flex: 1; margin: 0; padding: 16px 18px 28px; overflow: auto; min-height: 0;
  font: 12.5px/1.6 var(--mono); color: var(--ink-2); white-space: pre-wrap; word-break: break-word; tab-size: 2;
}
.md-out .h { color: var(--ink); font-weight: 700; }
.md-out .b { color: var(--ink); font-weight: 700; }
.md-out .fm { color: var(--ink-3); }
.md-out .tag { color: var(--ink-3); }
.md-out .fence { color: var(--ink-3); }
.md-out .code { color: var(--ink); }
.md-out .ic { color: var(--accent); }
.md-out .q { color: var(--ink-3); font-style: italic; }
.md-out .hr { color: var(--ink-3); }

.demo-note { margin-top: 14px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ---------- how ---------- */

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 32px); }
@media (max-width: 760px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { border-top: 2px solid var(--ink); padding-top: 18px; }
.step-n { font: 600 13px var(--mono); color: var(--accent); }
.steps h3 { margin: 8px 0 8px; }
.steps p { color: var(--ink-2); font-size: 15.5px; }

/* ---------- features ---------- */

.features { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.grid article { background: var(--surface); padding: 26px 24px 28px; }
.grid h3 { margin-bottom: 8px; }
.grid p { color: var(--ink-2); font-size: 15.5px; }

/* ---------- support ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
tbody th { font-weight: 650; white-space: nowrap; }
td code { white-space: nowrap; }
td { color: var(--ink-2); }
.pill { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; margin-right: 6px; color: var(--ink); }
.pill.full { background: var(--accent-soft); color: var(--accent); }
.pill.page { background: var(--well); border: 1px solid var(--rule-strong); }
.fine { margin-top: 16px; color: var(--ink-3); font-size: 14.5px; max-width: 760px; }
.fine strong { color: var(--ink-2); }

/* ---------- install ---------- */

.install { background: var(--surface); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.install-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 6vw, 80px); align-items: start; }
@media (max-width: 820px) { .install-grid { grid-template-columns: minmax(0, 1fr); } }
.install-grid > div p { color: var(--ink-2); margin: 16px 0 26px; }
.install-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.install-steps li {
  counter-increment: s; position: relative; padding: 16px 0 16px 48px; border-bottom: 1px solid var(--rule); color: var(--ink-2);
}
.install-steps li:first-child { padding-top: 4px; }
.install-steps li:first-child::before { top: 2px; }
.install-steps li::before {
  content: counter(s); position: absolute; left: 0; top: 14px;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 600 13px var(--mono); color: var(--accent); background: var(--accent-soft);
}
.install-steps b { color: var(--ink); }

/* ---------- faq ---------- */

.faq h2 { margin-bottom: 24px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer; list-style: none; padding: 18px 32px 18px 0; position: relative;
  font-weight: 600; font-size: 1.04rem; letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 14px; font: 400 22px var(--mono); color: var(--ink-3);
  transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; color: var(--ink-2); }

/* ---------- footer ---------- */

.foot { padding: 36px 0 48px; font-size: 14px; color: var(--ink-3); }
.foot-inner { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; }
.foot .brand { color: var(--ink); font-size: 15px; }
.foot-inner > a { margin-left: auto; }
.foot a { color: var(--ink-2); }
@media (max-width: 640px) { .foot-inner > a { margin-left: 0; } }
