/* CortexDB site — light, mobile first, no framework. */

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #faf9f6;
  --surface: #ffffff;
  --sunken: #f3f1ec;
  --ink: #15171c;
  --ink-2: #3d424c;
  --muted: #646a75;
  --line: #e4e1d9;
  --line-strong: #d3cfc5;
  --accent: #0b6e59;
  --accent-ink: #085444;
  --accent-soft: #e2f1ec;
  --screen: #11151d;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(21 23 28 / 0.04), 0 8px 24px -12px rgb(21 23 28 / 0.12);
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 76px;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

:lang(zh) body, body:lang(zh) { line-height: 1.75; }

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

a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

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

code, kbd, pre { font-family: var(--mono); font-size: 0.875em; }

:not(pre) > code {
  background: var(--sunken);
  border: 1px solid var(--line);
  padding: 0.08em 0.38em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
}
.skip:focus { top: 12px; color: #fff; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(250 249 246 / 0.86);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand svg { width: 28px; height: 28px; flex: none; }
.brand:hover { color: var(--ink); }

.nav-links {
  display: none;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 15px;
}
.nav-links a:hover { background: var(--sunken); color: var(--ink); }

.bar-actions { display: flex; align-items: center; gap: 8px; }

.lang {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.lang:hover { color: var(--ink); background: var(--surface); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2a2e37; color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
@media (max-width: 479px) {
  .bar-actions .btn-sm .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bar-actions .btn-sm { width: 44px; min-height: 44px; padding: 0; }
}

/* mobile menu: a native disclosure, so it works without script */
.menu { position: relative; }
.menu > summary {
  list-style: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary svg { width: 20px; height: 20px; }
.menu[open] > summary { border-color: var(--ink-2); }
.menu-panel {
  position: absolute;
  right: 0;
  top: 52px;
  width: min(280px, calc(100vw - 2 * var(--gutter)));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
}
.menu-panel a {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.menu-panel a:hover { background: var(--sunken); }

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .menu { display: none; }
}

/* ---------- type ---------- */

h1, h2, h3 { letter-spacing: -0.022em; line-height: 1.12; margin: 0; font-weight: 650; }
h1 { font-size: clamp(2.3rem, 1.4rem + 4.2vw, 4.1rem); letter-spacing: -0.035em; line-height: 1.03; }
h2 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem); }
h3 { font-size: 1.12rem; letter-spacing: -0.01em; line-height: 1.3; }
:lang(zh) h1 { letter-spacing: -0.01em; line-height: 1.15; }
:lang(zh) h2, :lang(zh) h3 { letter-spacing: 0; }
p { margin: 0; }
h1, h2 { text-wrap: balance; }
/* A phrase that should not split across lines in CJK headings, which can
   otherwise break between any two characters; it still wraps inside itself
   when it is wider than the line. */
.ph { display: inline-block; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid #c6e3da;
  border-radius: 999px;
  padding: 5px 12px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.section { padding-block: clamp(56px, 8vw, 104px); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head p { margin-top: 14px; color: var(--ink-2); font-size: 1.08rem; }
.section-head .kicker { margin-top: 0; font-size: 13px; color: var(--accent-ink); }
.kicker {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  margin-bottom: 12px;
}

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

.hero { padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(48px, 7vw, 88px); }
.hero-grid { display: grid; gap: clamp(32px, 5vw, 56px); align-items: center; }
.hero h1 { margin-top: 20px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { margin-top: 22px; font-size: clamp(1.06rem, 1rem + 0.35vw, 1.22rem); color: var(--ink-2); max-width: 40em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.install {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow);
}
.install code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 14px;
  background: none;
  border: 0;
  padding: 0;
  scrollbar-width: none;
}
.install code::-webkit-scrollbar { display: none; }
.install .prompt { color: var(--muted); user-select: none; }

.copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--ink-2);
  font: 600 13px var(--sans);
  cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--line-strong); }
.copy svg { width: 15px; height: 15px; }
.copy.done { color: var(--accent-ink); border-color: #c6e3da; background: var(--accent-soft); }

.screen {
  margin: 0;
  background: var(--screen);
  border-radius: var(--radius);
  border: 1px solid #222a36;
  box-shadow: 0 2px 4px rgb(21 23 28 / 0.06), 0 30px 60px -28px rgb(11 30 40 / 0.45);
  overflow: hidden;
}
.screen-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding-inline: 14px;
  background: #1a202b;
  border-bottom: 1px solid #262f3d;
  font: 12px var(--mono);
  color: #93a0b4;
}
.screen-bar i { width: 10px; height: 10px; border-radius: 50%; background: #3a4354; }
.screen-bar span { margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen img, .screen video { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.caption { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* Grid items default to min-width: auto, so a line that never wraps — the
   install command — would widen its column past the screen. */
.hero-grid > *, .split > *, .fit > *, .grid > *, .steps > * { min-width: 0; }

@media (min-width: 980px) {
  .hero-grid { grid-template-columns: 1.02fr 1fr; }
}

/* ---------- facts ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0;
}
.facts div { background: var(--surface); padding: 18px 20px; }
.facts dt { font: 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 6px 0 0; font-weight: 550; color: var(--ink); }

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.card .icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 16px;
}
.card .icon svg { width: 21px; height: 21px; }
.card p { margin-top: 10px; color: var(--ink-2); font-size: 15.5px; }
.card ul { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.card li + li { margin-top: 4px; }

/* ---------- get started ---------- */

.steps { display: grid; gap: 16px; }
/* Wide: the Go example gets the full left column, the two shell blocks stack
   on the right. */
@media (min-width: 980px) {
  .steps { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .steps > .step:first-child { grid-row: span 2; align-self: start; }
}
.step { display: flex; flex-direction: column; min-width: 0; }
.step h3 { display: flex; align-items: baseline; gap: 10px; }
.step h3 span { font: 600 13px var(--mono); color: var(--accent-ink); }
.step > p { margin: 8px 0 14px; color: var(--ink-2); font-size: 15.5px; }

.code {
  position: relative;
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
  font: 12px var(--mono);
  color: var(--muted);
}
.code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  tab-size: 4;
}
.tok-k { color: #8a3ffc; }
.tok-s { color: #0b6e59; }
.tok-c { color: #8a8f99; font-style: italic; }
.tok-f { color: #1f5fa8; }

/* ---------- benchmarks ---------- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
caption { text-align: left; padding: 16px 20px 0; color: var(--muted); font-size: 14px; caption-side: top; }
th, td { padding: 13px 20px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 14px; }
.gain { color: var(--accent-ink); font-weight: 600; }
.bar-cell { width: 34%; }
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter b { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); }
.meter s { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: #b9b4a8; text-decoration: none; }
.note { margin-top: 14px; color: var(--muted); font-size: 14px; max-width: 70em; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  margin-top: 20px;
}
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat b { display: block; font-size: 1.9rem; letter-spacing: -0.03em; font-weight: 650; }
.stat span { display: block; margin-top: 4px; color: var(--ink-2); font-size: 14.5px; }

/* ---------- split ---------- */

.split { display: grid; gap: clamp(28px, 4vw, 48px); align-items: center; }
@media (min-width: 980px) { .split { grid-template-columns: 1fr 1.1fr; } }
.checks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--ink-2); }
.checks svg { width: 20px; height: 20px; margin-top: 3px; color: var(--accent); }
.checks.no svg { color: #a3a09a; }

.fit { display: grid; gap: 16px; }
@media (min-width: 760px) { .fit { grid-template-columns: 1fr 1fr; } }

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

.faq { display: grid; gap: 10px; max-width: 860px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  font-weight: 600;
  min-height: 52px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq details > div { padding: 0 20px 18px; color: var(--ink-2); }
.faq details > div p + p { margin-top: 10px; }

/* ---------- cta + footer ---------- */

.cta {
  background: var(--ink);
  color: #e9ebef;
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(28px, 5vw, 56px);
  display: grid;
  gap: 24px;
  align-items: center;
}
.cta h2 { color: #fff; }
.cta p { color: #b8bec9; margin-top: 10px; }
.cta .btn-primary { background: #fff; color: var(--ink); }
.cta .btn-primary:hover { background: #e9ebef; }
.cta .btn-ghost { background: transparent; color: #fff; border-color: #4a505c; }
.cta .btn-ghost:hover { border-color: #fff; }
@media (min-width: 900px) { .cta { grid-template-columns: 1.4fr auto; } }

.site-footer { padding-block: 40px 56px; color: var(--muted); font-size: 14px; }
.footer-grid { display: grid; gap: 24px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }
.site-footer h4 { margin: 0 0 10px; font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); font-weight: 600; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.fine { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

@media print {
  .site-header, .menu, .copy, .cta { display: none !important; }
  body { background: #fff; }
}

/* Desktop shot with a phone shot overlapping its corner. */
.duo { margin: 0; position: relative; padding-bottom: 36px; }
.duo .phone {
  position: absolute; right: -6px; bottom: 0; width: clamp(110px, 26%, 170px);
  border-radius: 22px; overflow: hidden; border: 5px solid #11151d;
  box-shadow: 0 18px 40px -12px rgba(20, 24, 33, .45);
}
.duo .phone img { display: block; width: 100%; height: auto; }
.duo .caption { max-width: calc(100% - clamp(120px, 28%, 180px)); }
