/* Pico website: a warm, professional theme built around the brand plum (#39036B). */

:root {
  --bg: #faf5ec;
  --bg-alt: #f3ebdd;
  --surface: #fffcf6;
  --border: #e6dac6;
  --text: #2b211a;
  --muted: #6d5d4e;
  --brand: #39036b;
  --brand-2: #9221f5;
  --accent: #b5532a;
  --accent-soft: #f6e2d3;

  --code-bg: #2a211c;
  --code-bar: #362a23;
  --code-text: #f1e6d8;
  --code-dim: #9a8673;
  --tok-kw: #f0a35e;
  --tok-str: #b9d38a;
  --tok-num: #e7c26b;
  --tok-type: #e6a0c8;
  --tok-fn: #8fc4d9;
  --tok-dec: #d59bff;
  --tok-com: #8a7766;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 35, 15, .06), 0 12px 32px rgba(60, 35, 15, .10);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1613;
    --bg-alt: #221c18;
    --surface: #27201b;
    --border: #3a2f27;
    --text: #f1e7da;
    --muted: #b3a291;
    --brand: #c9a0ff;
    --brand-2: #b266ff;
    --accent: #ec8a57;
    --accent-soft: #3a2a20;
    --code-bg: #15110e;
    --code-bar: #201a16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; }
p code, li code {
  background: var(--accent-soft);
  padding: .1em .35em;
  border-radius: 5px;
}
.dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  .dark-only { display: inline; }
  .light-only { display: none; }
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px max(16px, calc((100vw - 1160px) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--brand); text-decoration: none;
  font: 650 20px var(--serif);
}
.topnav { display: flex; gap: 22px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; }
.topnav a:hover { color: var(--text); }

main > section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 96px 16px;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-top: 72px !important;
}
.hero-mark {
  display: flex; align-items: center; gap: 14px;
  font: 650 44px/1 var(--serif);
  color: var(--brand);
}
.hero-mark img { width: 72px; height: 72px; }
.hero h1 {
  font: 650 clamp(36px, 5vw, 58px)/1.08 var(--serif);
  letter-spacing: -.02em;
  margin: 18px 0 18px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 18px; color: var(--muted); max-width: 34em; margin: 0 0 28px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.button {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) {
  .button.primary { color: #1b1613; }
}

/* Code windows */
.window {
  background: var(--code-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.window-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  background: var(--code-bar);
}
.window-bar span { width: 11px; height: 11px; border-radius: 50%; background: #5a4a3e; }
.window-bar span:nth-child(1) { background: #e0715a; }
.window-bar span:nth-child(2) { background: #e8b65a; }
.window-bar span:nth-child(3) { background: #8fbf6a; }
.window-bar b {
  margin-left: 10px;
  font: 500 13px var(--mono);
  color: var(--code-dim);
}
.window-term {
  padding: 12px 20px 16px;
  border-top: 1px solid #3d3029;
  font: 14px/1.6 var(--mono);
  color: var(--code-text);
}
.window-term .prompt { color: var(--tok-kw); }
.window-term .out { color: var(--code-dim); }

pre.code {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  font: 14px/1.65 var(--mono);
  font-variant-ligatures: none;
  tab-size: 2;
}
pre.code code { font-size: inherit; }
.t-kw { color: var(--tok-kw); }
.t-str { color: var(--tok-str); }
.t-num { color: var(--tok-num); }
.t-type { color: var(--tok-type); }
.t-fn { color: var(--tok-fn); }
.t-dec { color: var(--tok-dec); }
.t-com { color: var(--tok-com); font-style: italic; }
.t-interp { color: var(--code-text); }

/* Section headings */
.section-title {
  font: 650 clamp(28px, 3.6vw, 40px)/1.15 var(--serif);
  letter-spacing: -.015em;
  margin: 0 0 10px;
  color: var(--brand);
}
.section-lede { color: var(--muted); font-size: 18px; margin: 0 0 40px; }

/* Basics */
.basics { border-top: 1px solid var(--border); }
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card h3 { font: 650 19px/1.3 var(--serif); margin: 0 0 8px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

/* Features: scroll-driven tour */
.features { border-top: 1px solid var(--border); max-width: 1280px !important; }
.tour {
  display: grid;
  grid-template-columns: 110px minmax(0, .8fr) minmax(0, 1.55fr);
  gap: 32px;
}
.tour-rail {
  list-style: none; margin: 0; padding: 0;
  position: sticky; top: 120px; align-self: start;
  border-left: 2px solid var(--border);
}
.tour-rail li a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .2s, border-color .2s;
}
.tour-rail li a:hover { color: var(--text); }
.tour-rail li a.active { color: var(--accent); border-left-color: var(--accent); }

.step {
  min-height: 78vh;
  display: flex; flex-direction: column; justify-content: center;
  opacity: .4;
  transition: opacity .35s;
}
.step:last-child { min-height: 60vh; }
.step.active { opacity: 1; }
.step-num { font: 500 14px var(--mono); color: var(--accent); letter-spacing: .1em; }
.step h3 { font: 650 30px/1.2 var(--serif); margin: 6px 0 12px; }
.step p { margin: 0; color: var(--muted); font-size: 17px; }
.step pre.code { margin-top: 22px; border-radius: var(--radius); box-shadow: var(--shadow); }
.js .step pre.code { display: none; }

.stage {
  position: sticky; top: max(88px, calc(50vh - var(--stage-h, 520px) / 2 + 30px)); align-self: start;
}
.stage-panels { position: relative; min-height: 470px; }
.stage-panels pre.code { font-size: clamp(11.5px, .95vw, 13px); padding: 20px 18px; }
.stage-panels pre.code {
  position: absolute; inset: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .35s, transform .35s;
  pointer-events: none;
}
.stage-panels pre.code.active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
html:not(.js) .stage, html:not(.js) .tour-rail { display: none; }
html:not(.js) .tour { grid-template-columns: 1fr; }
html:not(.js) .step { opacity: 1; min-height: 0; padding: 32px 0; }

/* Tooling */
.tooling { border-top: 1px solid var(--border); }
.tooling-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}
.tooling-grid pre.term { border-radius: var(--radius); box-shadow: var(--shadow); }
.tooling-list { margin: 0; padding: 0; list-style: none; }
.tooling-list li {
  padding: 14px 0 14px 28px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  position: relative;
}
.tooling-list li::before {
  content: ""; position: absolute; left: 4px; top: 23px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
}
.tooling-list strong { color: var(--text); }

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--bg-alt);
}

/* Narrow screens: code sits under each step, no sticky stage */
@media (max-width: 1080px) {
  .tour { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .tour-rail { display: none; }
}
/* Below ~1000px the samples don't fit beside the text: stack them under each step instead. */
@media (max-width: 1000px) {
  .tour { grid-template-columns: minmax(0, 1fr); }
  .stage { display: none; }
  .step, .step:last-child { min-height: 0; opacity: 1; padding: 28px 0; }
  .js .step pre.code { display: block; }
}
@media (max-width: 860px) {
  main > section { padding: 64px 16px; }
  .hero, .tooling-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .tour { grid-template-columns: minmax(0, 1fr); }
  .stage { display: none; }
  .step, .step:last-child { min-height: 0; opacity: 1; padding: 28px 0; }
  .js .step pre.code { display: block; }
  pre.code { font-size: 13px; padding: 16px; }
  .topnav { gap: 14px; }
  .topnav a:not(:last-child):nth-child(n+3) { display: none; }
}
@media (min-width: 861px) and (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .step, .stage-panels pre.code { transition: none; }
}

/* Get started */
.start { border-top: 1px solid var(--border); }
.start-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.start-grid .card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.start-grid h3 { margin: 0; }
.start-grid h3 small { color: var(--muted); font-weight: 500; font-size: 14px; margin-left: 6px; }
.start-grid p { margin: 0; color: var(--muted); font-size: 15px; }
.start-grid pre.code { margin: 0; font-size: 12.5px; overflow-x: auto; }
.start-try {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 32px;
  align-items: start;
}
.start-try h3 { margin-top: 0; }
.start-try p { color: var(--muted); }
.start-try pre.code { margin: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 860px) {
  .start-grid, .start-try { grid-template-columns: minmax(0, 1fr); }
}
