:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --stroke: rgba(0, 0, 0, 0.09);
  --text: #1b1b1b;
  --text-2: #565656;
  --accent: #005fb8;
  --accent-hover: #0a6cc4;
  --on-accent: #ffffff;
  --code-bg: #f1f4f8;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 16px 40px rgba(0, 0, 0, 0.09);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202020;
    --surface: #2b2b2b;
    --stroke: rgba(255, 255, 255, 0.09);
    --text: #ffffff;
    --text-2: #c9c9c9;
    --accent: #60cdff;
    --accent-hover: #7ad6ff;
    --on-accent: #000000;
    --code-bg: #1b1b1b;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 16px 40px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.container { width: min(1120px, 100% - 40px); margin-inline: auto; }

.skip-link { position: absolute; left: -9999px; top: 12px; z-index: 20; padding: 8px 14px; border-radius: 6px; background: var(--surface); color: var(--text); }
.skip-link:focus { left: 16px; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.brand:hover { color: var(--text); }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 18px; border-radius: 6px;
  font: 600 15px/1 var(--font); text-decoration: none; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--stroke);
}
.button:hover { color: var(--text); border-color: var(--text-2); }
.button.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.button.accent:hover { background: var(--accent-hover); color: var(--on-accent); }
.button.subtle { background: transparent; }

.hero { text-align: center; padding: 72px 0 24px; }
.eyebrow { margin: 0 0 10px; color: var(--text-2); font-weight: 600; font-size: 15px; }
h1 { font: 700 clamp(38px, 6vw, 62px)/1.08 var(--display); letter-spacing: -0.02em; margin: 0 0 16px; }
.lead { font-size: clamp(18px, 2.2vw, 22px); color: var(--text-2); margin: 0 auto 28px; max-width: 640px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 44px; }
.shot { margin: 0; }
.shot img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); }
/* Below 1000 px wide, the picture keeps a readable size and crops its sides, around the chat in the middle.
   The sizes attribute in index.html assumes this height: 380 × 1233 / 436 ≈ 1075 px wide. */
@media (max-width: 1000px) { .shot img { height: 380px; object-fit: cover; } }

.section { padding: 48px 0; }
h2 { font: 700 clamp(26px, 3.4vw, 34px)/1.2 var(--display); letter-spacing: -0.01em; margin: 0 0 22px; }
h3 { font: 600 18px/1.35 var(--display); margin: 0 0 8px; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; counter-reset: step; }
.steps li, .card { background: var(--surface); border: 1px solid var(--stroke); border-radius: 10px; padding: 20px 22px; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 12px;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700;
}
.steps p, .card p { margin: 0; color: var(--text-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
@media (max-width: 420px) { .cards { grid-template-columns: 1fr; } }

/* The FAQ is one list at every width: questions and answers in a single panel, with a line between them. */
.faq { background: var(--surface); border: 1px solid var(--stroke); border-radius: 10px; }
.faq article { padding: 18px 22px; }
.faq article + article { border-top: 1px solid var(--stroke); }
.faq h3 { margin-bottom: 4px; }
.faq p { margin: 0; max-width: 760px; color: var(--text-2); }

code, kbd { font-family: var(--mono); font-size: 0.88em; }
code { background: var(--code-bg); border: 1px solid var(--stroke); border-radius: 4px; padding: 0.05em 0.35em; overflow-wrap: anywhere; }
kbd { background: var(--surface); border: 1px solid var(--stroke); border-bottom-width: 2px; border-radius: 4px; padding: 0.05em 0.4em; }

/* Variables: one list. Each row has a snippet that uses the variable, and a text box where it runs.
   script.js plays the rows; without it, each box shows the result. */
.vars-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.vars-head > div { flex: 1 1 460px; min-width: 0; }
.vars-head h2 { margin-bottom: 10px; }
.vars-head p { max-width: 760px; margin: 0; }
.button.small { min-height: 32px; padding: 0 12px; gap: 8px; font-size: 14px; }
.demo-toggle { margin-left: auto; }
.demo-toggle[data-playing="true"] .icon-play, .demo-toggle[data-playing="false"] .icon-pause { display: none; }
.vars { container: vars / inline-size; margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--stroke); border-radius: 10px; }
.var { display: grid; gap: 14px; padding: 20px 22px; }
.var + .var { border-top: 1px solid var(--stroke); }
.var-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 4px; font: 600 17px/1.35 var(--display); }
.var-token { font-size: 13px; }
.var-text p { margin: 0; color: var(--text-2); }
.var-demo { display: grid; gap: 8px; }
.var-panel { position: relative; padding: 10px 12px 12px; background: var(--bg); border: 1px solid var(--stroke); border-radius: 8px; }
.var-arrow { display: grid; place-items: center; color: var(--text-2); }
.var-arrow svg { transform: rotate(90deg); }
.var-arrow path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@container vars (min-width: 760px) {
  .var { grid-template-columns: minmax(170px, 0.8fr) minmax(0, 2.2fr); align-items: start; gap: 28px; }
  .var-demo { grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1.2fr); }
  .var-arrow svg { transform: none; }
}
.lbl { margin: 0 0 6px; color: var(--text-2); font: 600 12px/1.4 var(--font); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--text-2); font-size: 13px; line-height: 1.8; }
.kv dd { min-width: 0; margin: 0; line-height: 1.8; }
code.trig { white-space: nowrap; }
code.repl { white-space: pre-wrap; overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.tok { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 20%, transparent); }

.demo-field { display: grid; padding: 5px 10px 4px; background: var(--surface); border: 1px solid var(--stroke); border-bottom: 2px solid var(--accent); border-radius: 4px; font-size: 15px; line-height: 1.6; }
.demo-field > span { grid-area: 1 / 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.demo-sizer { visibility: hidden; }
.demo-live { transition: opacity 0.25s ease; }
.demo-live.clearing { opacity: 0; }
.demo-typed.hit, .demo-new { border-radius: 3px; background-color: color-mix(in srgb, var(--accent) 24%, transparent); }
.demo-new { transition: background-color 1.4s ease-out 0.5s; }
.demo-new.settled { background-color: transparent; }

.caret { display: inline-block; width: 0; height: 1.2em; margin-right: -1.5px; border-left: 1.5px solid currentColor; vertical-align: -0.22em; }
@keyframes caret-blink { 50% { opacity: 0; } }
.vars.playing .caret { animation: caret-blink 1.06s steps(1, end) infinite; }
.vars.playing .typing .caret { animation: none; }

.demo-clip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; font-size: 13px; line-height: 1.5; }
.demo-url { padding: 2px 12px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 999px; color: var(--text-2); }
.demo-url-text { padding: 1px 0; transition: background-color 0.15s ease, color 0.15s ease; }
.demo-url-text.selected { background-color: var(--accent); color: var(--on-accent); }
.demo-keys { color: var(--text-2); opacity: 0; transition: opacity 0.15s ease; }
.demo-keys.on { opacity: 1; }
.demo-keys kbd { display: inline-block; font-size: 12px; }
@keyframes key-press { 40% { transform: translateY(1px); } }
.vars.playing .demo-keys.on kbd { animation: key-press 0.3s ease; }

/* A small copy of the window Text Expander opens to ask for a {{prompt:…}} answer. */
.demo-ask {
  position: absolute; z-index: 1; top: 4px; bottom: 4px; left: 50%; width: min(100% - 8px, 300px);
  display: flex; flex-direction: column; justify-content: center; padding: 5px 12px 6px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 8px; box-shadow: var(--shadow);
  font-size: 12px; line-height: 16px;
  opacity: 0; visibility: hidden; transform: translateX(-50%) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s 0.18s;
}
.demo-ask.open { opacity: 1; visibility: visible; transform: translateX(-50%); transition: opacity 0.18s ease, transform 0.18s ease; }
.demo-ask-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; color: var(--text-2); }
.demo-ask-label { margin-bottom: 2px; }
.demo-ask-row { display: flex; gap: 6px; }
.demo-ask-box { flex: 1; min-width: 0; padding: 3px 8px 2px; background: var(--surface); border: 1px solid var(--stroke); border-bottom: 2px solid var(--accent); border-radius: 4px; font-size: 13px; line-height: 18px; white-space: pre; overflow: hidden; }
.demo-ask-ok { display: grid; place-items: center; min-width: 64px; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-weight: 600; transition: transform 0.1s ease, filter 0.1s ease; }
.demo-ask-ok.pressed { transform: scale(0.96); filter: brightness(0.88); }

.site-footer { border-top: 1px solid var(--stroke); padding: 28px 0 44px; color: var(--text-2); font-size: 14px; }
.site-footer p { margin: 0 0 6px; }
