/* Parel public site. One stylesheet, no build step, no framework.
   Tokens first (colour, type, space, radius, shadow), then the shell, then components, then page sections.
   Light and dark follow the system setting. Everything is sized in rem except hairlines. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #faf9f6;
  --bg-2: #f2f0ea;
  --card: #ffffff;
  --fg: #15171a;
  --fg-2: #4d5157;
  --fg-3: #6f737a;
  --line: #e4e1d9;
  --line-2: #cfcbc1;
  --accent: #0f6b4b;
  --accent-2: #0b5439;
  --accent-soft: #e3f2ea;
  --on-accent: #ffffff;
  --warn: #9a3f12;
  --warn-soft: #fbe9df;
  --code-bg: #f3f1ec;
  --code-fg: #1f2327;
  --selection: #cfe9db;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --t-xs: 0.78rem;
  --t-s: 0.875rem;
  --t-base: 1rem;
  --t-l: 1.125rem;
  --t-xl: 1.375rem;
  --t-2xl: 1.75rem;
  --t-3xl: clamp(2rem, 1.2rem + 3.4vw, 3.6rem);

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 6rem;

  --r-s: 6px;
  --r: 12px;
  --r-l: 20px;

  --shadow-s: 0 1px 2px rgba(20, 24, 22, 0.06);
  --shadow: 0 10px 30px -12px rgba(20, 24, 22, 0.18), 0 1px 2px rgba(20, 24, 22, 0.06);

  --max: 68rem;
  --measure: 62ch;
  --header-h: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1110;
    --bg-2: #151816;
    --card: #1a1d1b;
    --fg: #ecebe6;
    --fg-2: #aeada6;
    --fg-3: #8a8982;
    --line: #2a2e2b;
    --line-2: #3a3f3b;
    --accent: #6fd3a5;
    --accent-2: #8fe0bb;
    --accent-soft: #16302a;
    --on-accent: #07150e;
    --warn: #f0a070;
    --warn-soft: #3a2218;
    --code-bg: #14171a;
    --code-fg: #e3e6e8;
    --selection: #2a5c45;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: var(--t-base) / 1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--selection); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--s-3); font-weight: 650; text-wrap: balance; }
h1 { font-size: var(--t-3xl); letter-spacing: -0.03em; }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-l); letter-spacing: -0.01em; }
h4 { font-size: var(--t-base); }
p { margin: 0 0 var(--s-4); }
p, li { max-width: var(--measure); text-wrap: pretty; }
small { font-size: var(--t-s); }
strong { font-weight: 650; }
img, svg { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
code, kbd, pre { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--code-bg); color: var(--code-fg); padding: 0.1em 0.4em; border-radius: var(--r-s); overflow-wrap: anywhere; }
pre {
  position: relative;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s-4) var(--s-5);
  overflow: auto;
  line-height: 1.55;
  margin: 0 0 var(--s-4);
  -webkit-overflow-scrolling: touch;
}
pre code { background: none; padding: 0; font-size: var(--t-s); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-s); margin: 0 0 var(--s-5); }
th, td { text-align: left; vertical-align: top; padding: var(--s-3) var(--s-3); border-bottom: 1px solid var(--line); }
th { color: var(--fg-2); font-weight: 600; font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.04em; }
td p:last-child { margin: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 var(--s-5); -webkit-overflow-scrolling: touch; }
.table-wrap table { margin: 0; min-width: 34rem; }
.muted { color: var(--fg-2); }
.small { font-size: var(--t-s); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: -3rem; background: var(--accent); color: var(--on-accent); padding: var(--s-2) var(--s-4); border-radius: var(--r-s); z-index: 20; }
.skip:focus { top: var(--s-3); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--s-4); }
@media (min-width: 48em) { .wrap { padding: 0 var(--s-6); } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--fg); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand:hover { color: var(--fg); }
.brand .mark { width: 1.5rem; height: 1.5rem; color: var(--accent); flex: none; }
.brand .beta { font-size: var(--t-xs); font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 0.05em 0.5em; border-radius: 999px; margin-left: var(--s-1); letter-spacing: 0; }
.nav-desktop { display: none; }
.nav-desktop ul { display: flex; gap: var(--s-5); list-style: none; margin: 0; padding: 0; }
.nav-desktop a { color: var(--fg-2); text-decoration: none; font-size: var(--t-s); font-weight: 500; }
.nav-desktop a:hover, .nav-desktop a[aria-current="page"] { color: var(--fg); }
.header-actions { display: none; align-items: center; gap: var(--s-3); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-s); font-size: var(--t-s); font-weight: 600; background: var(--card); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary svg { width: 1rem; height: 1rem; }
.menu[open] > summary { background: var(--bg-2); }
.menu .sheet {
  position: absolute; right: 0; top: calc(100% + 0.5rem); min-width: 14rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: var(--s-2);
}
.menu .sheet ul { list-style: none; margin: 0; padding: 0; }
.menu .sheet a { display: block; padding: var(--s-2) var(--s-3); color: var(--fg); text-decoration: none; border-radius: var(--r-s); font-weight: 500; }
.menu .sheet a:hover { background: var(--bg-2); }
.menu .sheet .sep { border-top: 1px solid var(--line); margin: var(--s-2) 0; }
@media (min-width: 52em) {
  .nav-desktop, .header-actions { display: flex; }
  .menu { display: none; }
}

/* ---------- Buttons and pills ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 0.65rem 1.1rem; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--fg); font-weight: 600; font-size: var(--t-s); line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.btn:hover { background: var(--bg-2); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn.large { padding: 0.9rem 1.5rem; font-size: var(--t-base); }
.btn.small { padding: 0.35rem 0.7rem; font-size: var(--t-xs); }
.pill { display: inline-block; padding: 0.15em 0.65em; border-radius: 999px; font-size: var(--t-xs); font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.neutral { background: var(--bg-2); color: var(--fg-2); }
.eyebrow { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-s); font-weight: 600; color: var(--accent); margin-bottom: var(--s-4); }
.eyebrow::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }

/* ---------- Cards and grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-5); box-shadow: var(--shadow-s); }
.card h3 { margin-bottom: var(--s-2); }
.card p:last-child { margin: 0; }
.grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 40em) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60em) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Main and sections ---------- */
main { flex: 1; }
.section { padding: var(--s-8) 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; }
.section-head { max-width: 40rem; margin-bottom: var(--s-6); }
.section-head p { color: var(--fg-2); font-size: var(--t-l); margin: 0; }
@media (min-width: 48em) { .section { padding: var(--s-9) 0; } }

/* ---------- Hero ---------- */
.hero { padding: var(--s-7) 0 var(--s-8); }
.hero .wrap { display: grid; gap: var(--s-7); align-items: center; }
.hero h1 { max-width: 15ch; margin-bottom: var(--s-5); }
.hero .lede { font-size: var(--t-l); color: var(--fg-2); max-width: 52ch; margin-bottom: var(--s-6); }
.hero .cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.hero .fine { color: var(--fg-3); font-size: var(--t-s); }
@media (min-width: 60em) {
  .hero { padding: var(--s-9) 0; }
  .hero .wrap { grid-template-columns: 1.1fr 1fr; gap: var(--s-8); }
}

/* Example conversation */
.chat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); padding: var(--s-4); display: grid; gap: var(--s-3); font-size: var(--t-s); }
.chat .label { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); color: var(--fg-3); font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 var(--s-1); }
@media (max-width: 30em) { .chat .label span:last-child { display: none; } }
.chat .msg { padding: var(--s-3) var(--s-4); border-radius: var(--r); max-width: 100%; }
.chat .msg p { margin: 0; max-width: none; }
.chat .you { background: var(--bg-2); justify-self: end; max-width: 85%; border-bottom-right-radius: var(--r-s); }
.chat .ai { background: transparent; border: 1px solid var(--line); border-bottom-left-radius: var(--r-s); }
.chat .cost { display: inline-flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); font-family: var(--mono); font-size: var(--t-xs); color: var(--fg-2); }
.chat .cost b { color: var(--accent); font-weight: 600; }
.chat .cost .free { color: var(--warn); font-weight: 600; }

/* Steps */
.steps { counter-reset: step; display: grid; gap: var(--s-4); }
.steps .card { position: relative; padding-top: var(--s-6); }
.steps .card::before { counter-increment: step; content: counter(step); position: absolute; top: calc(-1 * var(--s-3)); left: var(--s-5); width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: var(--t-s); display: grid; place-items: center; }
@media (min-width: 48em) { .steps { grid-template-columns: repeat(3, 1fr); } }

/* Tools */
.tools { display: grid; gap: var(--s-4); }
.tool { display: grid; gap: var(--s-2); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-5); box-shadow: var(--shadow-s); }
.tool .top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.tool h3 { margin: 0; }
.tool .price { font-family: var(--mono); font-size: var(--t-base); font-weight: 600; white-space: nowrap; }
.tool .price small { font-family: var(--font); color: var(--fg-3); font-weight: 500; font-size: var(--t-xs); margin-left: 0.25em; }
.tool p { margin: 0; color: var(--fg-2); font-size: var(--t-s); }
.tool .free { font-size: var(--t-xs); color: var(--accent); font-weight: 600; }
.tool code { font-size: var(--t-xs); }
@media (min-width: 40em) { .tools { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); } }
.tool .top { flex-wrap: wrap; }
.rate-note { color: var(--fg-3); font-size: var(--t-s); margin-top: var(--s-4); }

/* Connect */
.connect { display: grid; gap: var(--s-4); }
@media (min-width: 56em) { .connect { grid-template-columns: 1fr 1fr; } }
.connect .card { display: grid; gap: var(--s-3); align-content: start; }
.connect ol { margin: 0; padding-left: 1.25rem; }
.connect ol li { margin: var(--s-2) 0; }
.connect pre { margin: 0; }
.copyline { display: flex; align-items: stretch; gap: var(--s-2); }
.copyline code, .copyline pre { flex: 1; margin: 0; display: flex; align-items: center; padding: var(--s-3) var(--s-4); font-size: var(--t-s); white-space: nowrap; overflow: auto; }
.copy-btn { position: absolute; top: var(--s-2); right: var(--s-2); }
pre.has-copy { padding-right: 5rem; }

/* FAQ */
.faq { display: grid; gap: var(--s-2); max-width: 46rem; }
.faq details { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.faq summary { cursor: pointer; padding: var(--s-4) var(--s-5); font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--fg-3); font-size: 1.25rem; font-weight: 400; flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq .body { padding: 0 var(--s-5) var(--s-4); color: var(--fg-2); }
.faq .body p:last-child { margin: 0; }

/* Final CTA */
.cta-band { background: var(--accent); color: var(--on-accent); border-radius: var(--r-l); padding: var(--s-7) var(--s-5); text-align: center; }
.cta-band h2 { color: inherit; }
.cta-band p { color: inherit; opacity: 0.9; margin: 0 auto var(--s-5); }
.cta-band .btn { background: var(--on-accent); color: var(--accent); border-color: transparent; }
.cta-band .btn:hover { background: color-mix(in srgb, var(--on-accent) 90%, var(--accent)); }

/* ---------- Docs layout ---------- */
.docs { display: grid; gap: var(--s-6); padding-top: var(--s-6); padding-bottom: var(--s-8); }
.docs .toc { font-size: var(--t-s); }
.docs .toc .toc-title { font-weight: 650; margin-bottom: var(--s-3); color: var(--fg); }
.docs .toc ol { list-style: none; margin: 0; padding: 0; }
.docs .toc ol ol { padding-left: var(--s-3); border-left: 1px solid var(--line); margin: var(--s-1) 0 var(--s-2); }
.docs .toc a { display: block; padding: 0.2rem 0; color: var(--fg-2); text-decoration: none; }
.docs .toc a:hover { color: var(--fg); }
.docs .toc a[aria-current="true"] { color: var(--accent); font-weight: 600; }
.docs .toc details > summary { cursor: pointer; font-weight: 650; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.docs .toc details[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.docs .toc details > .inner { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: var(--s-3) var(--s-4); background: var(--card); }
.docs article { min-width: 0; }
.docs article > h1 { margin-bottom: var(--s-3); }
.docs article > .lede { color: var(--fg-2); font-size: var(--t-l); margin-bottom: var(--s-6); }
.docs article h2 { margin-top: var(--s-8); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.docs article h2:first-of-type { margin-top: var(--s-6); }
.docs article h3 { margin-top: var(--s-6); }
.docs article h2 a, .docs article h3 a { color: inherit; text-decoration: none; }
.docs article h2 a:hover::after, .docs article h3 a:hover::after { content: " #"; color: var(--fg-3); font-weight: 400; }
.docs .tabs { display: grid; gap: var(--s-3); }
.docs .callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: var(--s-3) var(--s-4); border-radius: 0 var(--r-s) var(--r-s) 0; margin: 0 0 var(--s-4); }
.docs .callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.docs .callout p:last-child { margin: 0; }
@media (min-width: 56em) {
  .docs { grid-template-columns: 15rem minmax(0, 1fr); gap: var(--s-8); }
  .docs .toc { position: sticky; top: calc(var(--header-h) + var(--s-5)); align-self: start; max-height: calc(100dvh - var(--header-h) - var(--s-6)); overflow: auto; }
  .docs .toc details > summary { display: none; }
  .docs .toc details > .inner { border: 0; padding: 0; background: none; }
}

/* ---------- Prose pages (legal, status, 404) ---------- */
.prose { max-width: 46rem; padding: var(--s-6) 0 var(--s-8); }
.prose h1 { margin-bottom: var(--s-2); }
.prose h2 { margin-top: var(--s-7); }
.prose h3 { margin-top: var(--s-5); }
.prose .lede { color: var(--fg-2); font-size: var(--t-l); margin-bottom: var(--s-6); }
.prose em { color: var(--fg-2); }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: var(--s-1) 0; }
.prose table { font-size: var(--t-s); }
.prose .page-toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-6); font-size: var(--t-s); }
.prose .page-toc strong { display: block; margin-bottom: var(--s-2); }
.prose .page-toc ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: var(--s-5); }
.prose .page-toc li { break-inside: avoid; }
.prose .page-toc a { text-decoration: none; }
.prose .page-toc a:hover { text-decoration: underline; }
.prose .draft { font-size: var(--t-s); color: var(--fg-2); border: 1px dashed var(--line-2); border-radius: var(--r); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-5); }
.center { text-align: center; }
.notfound { padding: var(--s-9) 0; text-align: center; }
.notfound h1 { font-size: var(--t-3xl); }
.notfound .links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); margin-top: var(--s-5); }

/* Status */
.status-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) 0; border-bottom: 1px solid var(--line); }
.status-row .dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--fg-3); flex: none; }
.status-row .dot.ok { background: var(--accent); }
.status-row .name { font-weight: 600; flex: 1; }
.status-row .state { color: var(--fg-2); font-size: var(--t-s); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--s-7) 0 var(--s-7); color: var(--fg-2); font-size: var(--t-s); }
.site-footer .cols { display: grid; gap: var(--s-6); }
.site-footer h4 { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-3); margin-bottom: var(--s-3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.site-footer a { color: var(--fg-2); text-decoration: none; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }
.site-footer .about p { max-width: 32ch; }
.site-footer .legal-line { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); color: var(--fg-3); font-size: var(--t-xs); }
@media (min-width: 40em) { .site-footer .cols { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
