/* ─────────────────────────────────────────────────────────────────────
   Kosha — getkosha.dev
   Tokens mirror the "Kosha Landing" design. Colour roles:
     brand   #6740F4  buttons, the logo mark, the headline stat
     link    #6941C6  links and section kickers
     violet  #B692F6  brand accent on dark surfaces
   ───────────────────────────────────────────────────────────────────── */

:root {
  --ink:        #1A1A1E;
  --ink-2:      #26272B;
  --text:       #3F3F46;
  --text-2:     #51525C;
  --muted:      #70707B;
  --faint:      #A0A0AB;

  --line:       #E4E4E7;
  --line-soft:  #F0F0F0;
  --line-hard:  #D1D1D6;

  --bg:         #FFFFFF;
  --bg-tint:    #FAFAFA;

  --brand:      #6740F4;
  --link:       #6941C6;
  --link-hover: #53389E;
  --violet:     #B692F6;
  --violet-bg:  #FAFAFF;
  --violet-line:#E9D7FE;
  --violet-chip:#F4EBFF;

  --sans: "Public Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --shadow-sm: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08),
               0 4px 6px -2px rgba(16, 24, 40, 0.03);

  --shell: 1216px;
  --gutter: 32px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
}

h1, h2, h3, p, dl, dd, dt, pre { margin: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  background: var(--bg);
  color: var(--ink);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.skip:focus { left: 16px; top: 16px; }

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ─── Brand mark ──────────────────────────────────────────────────── */

.mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--brand);
  flex: none;
}
.mark-sm { width: 16px; height: 16px; border-radius: 5px; }

/* ─── Buttons ─────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-sm { font-size: 14px; padding: 9px 16px; }

.btn-primary { color: #FFFFFF; background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { color: #FFFFFF; background: var(--link-hover); border-color: var(--link-hover); }

.btn-secondary { color: var(--text); background: var(--bg); border-color: var(--line-hard); }
.btn-secondary:hover { color: var(--ink); border-color: var(--faint); }

.btn-invert { color: var(--ink); background: #FFFFFF; }
.btn-invert:hover { color: var(--ink); background: var(--line); }

.btn-outline-dark { color: #FAFAFA; background: transparent; border-color: var(--text-2); box-shadow: none; }
.btn-outline-dark:hover { color: #FFFFFF; border-color: var(--faint); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

/* ─── Header ──────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chip {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--link);
  background: var(--violet-chip);
  border: 1px solid var(--violet-line);
  border-radius: 9999px;
  padding: 3px 8px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.topnav > a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.topnav > a:hover { color: var(--ink); }
.topnav > a.btn { color: #FFFFFF; }

/* ─── Hero ────────────────────────────────────────────────────────── */

.hero { padding: 96px 0 80px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.hero-copy h1 {
  font-size: 60px;
  line-height: 66px;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}

.lede {
  margin-top: 24px;
  font-size: 20px;
  line-height: 31px;
  color: var(--text);
  max-width: 34ch;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-top: 40px;
}
.hero-fact dt { font-size: 14px; font-weight: 600; color: var(--ink); }
.hero-fact dd { font-size: 14px; color: var(--muted); }

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* ─── Terminal ────────────────────────────────────────────────────── */

.term {
  border: 1px solid var(--ink-2);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--ink-2);
  border-bottom: 1px solid var(--text);
}
.term-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  background: var(--text-2);
}
.term-title {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

.term-body {
  padding: 24px;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 26px;
  color: #FAFAFA;
  overflow-x: auto;
}
.term-body code { font: inherit; }
.term-body .c { color: var(--muted); }
.term-body .s { color: var(--violet); }

.term-foot {
  padding: 14px 24px;
  background: var(--ink-2);
  border-top: 1px solid var(--text);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

/* ─── Sections ────────────────────────────────────────────────────── */

.section {
  padding: 80px 0;
  border-top: 1px solid var(--line);
}
.section-tint { background: var(--bg-tint); }
.section-dark { background: var(--ink); }

.section-head {
  max-width: 60ch;
  margin-bottom: 40px;
}

.kicker {
  font-size: 14px;
  font-weight: 600;
  color: var(--link);
  margin-bottom: 12px;
}
.kicker-on-dark { color: var(--violet); }

.section h2 {
  font-size: 36px;
  line-height: 44px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.section-dark h2 { color: #FFFFFF; }

.section-lede {
  margin-top: 16px;
  font-size: 18px;
  line-height: 28px;
  color: var(--text);
}
.section-dark .section-lede { color: var(--faint); max-width: 46ch; }

.footnote {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 20px;
  color: var(--faint);
}

/* ─── Compare table ───────────────────────────────────────────────── */

.table-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll { overflow-x: auto; }

.compare {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 15px;
  text-align: left;
}

.compare th,
.compare td {
  padding: 18px 24px;
  vertical-align: top;
  line-height: 23px;
}

.compare thead th {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.compare thead th:first-child { width: 20%; }
.compare thead th.col-own { font-weight: 700; color: var(--ink); width: 28%; }
.compare thead th:nth-child(3),
.compare thead th:nth-child(4) { width: 26%; }

.compare tbody th {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.compare tbody td { color: var(--text-2); }
.compare tbody tr:not(:last-child) th,
.compare tbody tr:not(:last-child) td { border-bottom: 1px solid var(--line-soft); }

.compare .col-own {
  background: var(--violet-bg);
  border-left: 1px solid var(--violet-line);
  border-right: 1px solid var(--violet-line);
}
.compare tbody td.col-own { color: var(--ink-2); }

/* ─── Benchmark stats ─────────────────────────────────────────────── */

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

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.stat-figure {
  font-size: 44px;
  line-height: 52px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-figure-brand { color: var(--brand); }

.stat h3 {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.stat p:last-child {
  margin-top: 6px;
  font-size: 14px;
  line-height: 21px;
  color: var(--muted);
}

/* ─── Latency chart ───────────────────────────────────────────────── */

.perf {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.perf-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--line);
}

.perf-tab {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 10px 16px;
  margin-bottom: -1px;
  cursor: pointer;
}
.perf-tab:hover { color: var(--ink); }
.perf-tab.is-on {
  color: var(--ink);
  background: var(--bg);
  border-color: var(--line);
}

.perf-panel { margin: 0; }

.perf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 24px 0;
}

.perf-quality {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--link);
}

.perf-workload {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.perf-rows {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 24px 22px;
}

.perf-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 16px;
}

.perf-pct {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.perf-bars,
.perf-vals {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.perf-bar {
  display: block;
  height: 11px;
  min-width: 3px;
  border-radius: 2px;
}
.perf-bar-warm { background: var(--brand); }
.perf-bar-cold { background: var(--ink); }

.perf-vals { text-align: right; }

.perf-val {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 11px;
  font-variant-numeric: tabular-nums;
}
.perf-val-warm { color: var(--brand); }
.perf-val-cold { color: var(--ink); }

.perf-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 0 24px 22px;
}

.perf-key {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.swatch-warm { background: var(--brand); }
.swatch-cold { background: var(--ink); }

.perf-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
  border-radius: 0 0 12px 12px;
}

.perf-approach {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 18px;
  color: var(--muted);
}

.perf-src {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 18px;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Community ───────────────────────────────────────────────────── */

.community-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}

.crates {
  display: grid;
  gap: 1px;
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: 12px;
  overflow: hidden;
}

.crate {
  background: var(--ink-2);
  padding: 16px 20px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.crate dt {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--violet);
  min-width: 132px;
  flex: none;
}
.crate dd {
  font-size: 14px;
  line-height: 21px;
  color: var(--faint);
}

/* ─── Footer ──────────────────────────────────────────────────────── */

.foot { border-top: 1px solid var(--line); }

.foot-inner {
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.foot-license { font-size: 14px; color: var(--muted); }

.foot-links { display: flex; flex-wrap: wrap; gap: 24px; }
.foot-links a { font-size: 14px; color: var(--muted); }
.foot-links a:hover { color: var(--ink); }

/* ─── 404 ─────────────────────────────────────────────────────────── */

.notfound { padding: 120px 0 140px; }
.notfound h1 {
  font-size: 44px;
  line-height: 52px;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 22ch;
}
.notfound .lede { max-width: 46ch; }

/* ─── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .hero-grid,
  .community-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }
  .hero-copy h1 { font-size: 48px; line-height: 54px; }
  .lede, .section-dark .section-lede { max-width: 60ch; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
}

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

  .topbar-inner { gap: 16px; }
  .topnav { gap: 0; }
  .topnav > a:not(.btn) { display: none; }

  .hero { padding: 56px 0 56px; }
  .section { padding: 56px 0; }

  .hero-copy h1 { font-size: 38px; line-height: 44px; }
  .lede { font-size: 18px; line-height: 28px; margin-top: 20px; }
  .section h2 { font-size: 28px; line-height: 36px; }
  .section-lede { font-size: 16px; line-height: 26px; }

  .cta-row { margin-top: 28px; }
  .btn { width: 100%; justify-content: center; }
  .topnav > a.btn { width: auto; }

  .hero-facts { gap: 20px; flex-direction: column; }

  .term-body { font-size: 12.5px; line-height: 24px; padding: 18px; }

  .crate { flex-direction: column; gap: 4px; }
  .crate dt { min-width: 0; }

  .foot-inner { padding: 28px 0; flex-direction: column; align-items: flex-start; }
  .notfound { padding: 72px 0 88px; }
  .notfound h1 { font-size: 32px; line-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
