/* The colours are the logo's: indigo ground, muted bars, the amber of the chosen answer. */
:root {
  --bg: #ffffff;
  --fg: #1e1b4b;
  --muted: #55537a;
  --accent: #b45309;
  --accent-bg: #f59e0b;
  --accent-fg: #1e1b4b;
  --panel: #f5f5fb;
  --border: #e2e1ef;
  --code-bg: #1e1b4b;
  --code-fg: #e0e7ff;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12102e;
    --fg: #e0e7ff;
    --muted: #a5b4fc;
    --accent: #fbbf24;
    --panel: #1e1b4b;
    --border: #312e81;
    --code-bg: #0b0a1f;
  }
}

* { box-sizing: border-box; }

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

main, .bar, footer { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

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

code { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.3em;
}

/* Code never scrolls sideways: at desktop widths every block fits, and below that a long line
   wraps rather than pushing the page or hiding behind a scrollbar. */
pre {
  margin: 0;
  padding: 16px 18px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre .k { color: #a5b4fc; }
pre .s { color: #fcd34d; }
pre .n { color: #f59e0b; font-weight: 700; }
pre .c { color: #c4b5fd; font-weight: 600; }
pre .f { color: #818cf8; }
pre .m { color: #8b89b8; }

/* Header */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.2rem;
}
.brand:hover { text-decoration: none; }
.bar nav { display: flex; gap: 20px; flex-wrap: wrap; }
.bar nav a { color: var(--muted); font-weight: 500; }
.bar nav a:hover { color: var(--fg); text-decoration: none; }

/* Hero */
.hero { text-align: center; padding: 56px 0 40px; }
.hero-logo { display: block; margin: 0 auto 24px; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 auto 20px;
  max-width: 16em;
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 40em; margin: 0 auto 28px; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 0 0 24px; }
.button {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--fg);
  font-weight: 600;
}
.button:hover { text-decoration: none; border-color: var(--muted); }
.button.primary { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-fg); }
.motto { color: var(--muted); font-size: 0.95rem; }

/* Sections */
section { padding: 32px 0; }
section > h2 { font-size: 1.7rem; letter-spacing: -0.01em; margin: 0 0 16px; }
h3 { font-size: 1.2rem; margin: 32px 0 12px; }
.note { color: var(--muted); font-size: 0.95rem; }

/* The three primitives */
.primitives {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.primitives article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent-bg);
  border-radius: 12px;
  padding: 20px 22px;
}
.primitives h2 { margin: 0 0 8px; font-size: 1.4rem; }
.primitives h2 code { background: none; border: 0; padding: 0; font-size: 1em; }
.primitives p { margin: 0 0 8px; }
.returns { color: var(--muted); font-size: 0.95rem; }

/* Code windows */
figure { margin: 0; min-width: 0; }
.window {
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px -18px rgba(30, 27, 75, 0.55);
}
.window figcaption {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #a5b4fc;
  font-size: 0.82rem;
  font-weight: 600;
}
.window figcaption code { background: none; border: 0; padding: 0; color: #e0e7ff; }
/* Three window dots, the first in amber like the logo's chosen bar. */
.dots {
  position: relative;
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 32px;
  border-radius: 50%;
  background: #f59e0b;
}
.dots::before, .dots::after {
  content: "";
  position: absolute;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #818cf8;
  opacity: 0.5;
}
.dots::before { left: 16px; }
.dots::after { left: 32px; }
.took { margin-left: auto; color: #f59e0b; }

/* Request, response, and what it reads as */
.exchange {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
}
.windows { display: grid; gap: 16px; min-width: 0; }
.readout {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: grid;
  gap: 18px;
}
.readout p { margin: 0; }
.readout-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.answer { display: grid; gap: 6px; }
.answer + .answer { border-top: 1px solid var(--border); padding-top: 16px; }
.answer-head { display: flex; justify-content: space-between; align-items: baseline; }
.answer-head span { color: var(--muted); font-size: 0.85rem; }
.answer-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.answer-value small { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.answer-note { color: var(--muted); font-size: 0.85rem; }
.meter { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 5px; background: var(--accent-bg); }
.options { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.options li {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
.options li.picked { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-fg); font-weight: 700; }
.levels { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; align-items: flex-end; height: 28px; }
.levels li { flex: 1; border-radius: 3px; background: var(--border); }
.levels li:nth-child(1) { height: 20%; }
.levels li:nth-child(2) { height: 40%; }
.levels li:nth-child(3) { height: 60%; }
.levels li:nth-child(4) { height: 80%; }
.levels li:nth-child(5) { height: 100%; }
.levels li.picked { background: var(--accent-bg); }

/* SDK tabs: radio buttons and labels, no script */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs input { position: absolute; opacity: 0; pointer-events: none; }
.tabs label {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.tabs label:hover { color: var(--fg); }
.tabs input:checked + label { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--accent-fg); }
.tabs input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs .panel { display: none; flex-basis: 100%; margin-top: 8px; }
#sdk-rust:checked ~ .panel-rust,
#sdk-python:checked ~ .panel-python,
#sdk-ts:checked ~ .panel-ts { display: block; }

/* How it works */
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li {
  counter-increment: step;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-weight: 700;
}
.steps strong { display: block; }

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-top: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; border-top: 0; }

/* The TUI screenshot, taken in a dark terminal: the same frame in both colour schemes. */
.screenshot { margin: 8px 0 12px; }
.screenshot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px -20px rgba(30, 27, 75, 0.6);
}
kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--panel);
}

/* Hosts */
.hosts {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.hosts li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}
.hosts strong, .hosts span { display: block; }
.hosts span { color: var(--muted); font-size: 0.9rem; }

footer { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 20px; padding-bottom: 40px;
  color: var(--muted); font-size: 0.9rem; text-align: center; }

@media (max-width: 860px) {
  .exchange { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  pre { font-size: 0.72rem; padding: 14px; }
}
