/* quillflow website. System fonts only; no external requests. */
:root {
  --ink: #0e2233;
  --text: #22313f;
  --muted: #5b6b79;
  --line: #dde3e8;
  --surface: #ffffff;
  --canvas: #f5f7f9;
  --tint: #eef5f7;
  --brand: #0f5b78;
  --brand-strong: #0a4259;
  --brand-soft: #d9ecf2;
  --mint: #7fd3c7;
  --warm: #f4b860;
  --focus: #ffdd00;
  --code-bg: #0e2233;
  --code-text: #e6edf3;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(14 34 51 / 6%), 0 8px 24px rgb(14 34 51 / 8%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1f5f8;
    --text: #d5dde4;
    --muted: #9aa9b6;
    --line: #2a3a48;
    --surface: #13212d;
    --canvas: #0c1822;
    --tint: #102332;
    --brand: #6cc3dd;
    --brand-strong: #9fd9ea;
    --brand-soft: #173548;
    --code-bg: #08121a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}

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

html {
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--brand-strong);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

code,
kbd,
pre,
textarea {
  font-family: var(--mono);
  /* ">=" must look like what people type, not a "≥" ligature. */
  font-variant-ligatures: none;
}

code,
kbd {
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--ink);
}

kbd {
  padding: 0.1em 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
}

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.wrap-wide {
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  clip-path: none;
  background: var(--focus);
  color: #0b0c0c;
}

/* ---- header and footer ---------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand .logo {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--brand);
}

.brand--small {
  font-size: 1rem;
}

.brand--small .logo {
  width: 1.25rem;
  height: 1.25rem;
}

.site-nav ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--ink);
}

.menu-button {
  display: none;
}

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer p {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

/* ---- buttons ---------------------------------------------------------------------------------- */

.button {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.button:hover {
  border-color: var(--brand);
  color: var(--ink);
}

.button--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button--primary:hover {
  background: var(--brand-strong);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .button--primary,
  .button--primary:hover {
    color: #06141d;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---- hero -------------------------------------------------------------------------------------- */

.hero {
  padding: 4rem 0 3rem;
  background:
    radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--mint) 35%, transparent), transparent 70%),
    radial-gradient(40rem 25rem at -10% 110%, color-mix(in srgb, var(--warm) 25%, transparent), transparent 70%),
    var(--surface);
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  letter-spacing: -0.03em;
}

.lead {
  max-width: 38rem;
  margin: 0 0 1.75rem;
  color: var(--text);
  font-size: 1.2rem;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 2rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.95rem;
  list-style: none;
}

.facts strong {
  margin-right: 0.3rem;
  color: var(--ink);
  font-size: 1.2rem;
}

.demo {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.demo figcaption {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--tint);
  color: var(--muted);
  font-size: 0.9rem;
}

.demo__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #2ea44f;
  box-shadow: 0 0 0 3px rgb(46 164 79 / 20%);
}

.demo__frame {
  max-height: 34rem;
  padding: 1.25rem 1.5rem;
  overflow: auto;
  background: #fff;
  color: #0b0c0c;
}

.demo__note {
  margin: 0;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.demo__data {
  max-height: 14rem;
  margin: 0;
  padding: 0.75rem 1rem;
  overflow: auto;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.85rem;
}

/* The form inside the demo keeps its own (light) theme, like a real portal would,
   including native controls (radios, date pickers) in dark mode. */
.demo__frame,
.playground__frame {
  color-scheme: light;
}

.demo qf-form,
.playground__frame qf-form {
  --qf-max-width: 100%;
  font-size: 1.05rem;
}

/* ---- sections ------------------------------------------------------------------------------------ */

.section {
  padding: 4.5rem 0;
}

.section--tinted {
  background: var(--tint);
}

.section__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.section__lead {
  max-width: 44rem;
  margin: 0 0 2.5rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features li {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.features h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.features p {
  margin: 0;
  color: var(--muted);
}

.features q {
  color: var(--text);
  font-style: italic;
}

.audiences {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 2rem;
}

.audiences h3 {
  margin: 0 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 3px solid var(--mint);
}

.section--cta {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
}

.section--cta h2 {
  margin-top: 0;
  color: #fff;
  font-size: 2rem;
}

.section--cta .button {
  box-shadow: none;
}

.section--cta .button--primary {
  border-color: #fff;
  background: #fff;
  color: var(--brand-strong);
}

@media (prefers-color-scheme: dark) {
  .section--cta {
    background: linear-gradient(135deg, #0f5b78 0%, #0a4259 100%);
  }

  .section--cta .button--primary {
    color: #0a4259;
  }
}

.cta {
  text-align: center;
}

.cta .actions {
  justify-content: center;
}

/* ---- tabs, tables, code ------------------------------------------------------------------------------- */

.tabs [role="tablist"] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: -1px;
}

.tabs [role="tab"] {
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tabs [role="tab"][aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.tabs [role="tabpanel"] {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  background: var(--surface);
}

.tabs [role="tabpanel"] .code pre,
.tabs [role="tabpanel"] > pre {
  margin: 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink);
  font-weight: 650;
}

.sheet {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.sheet caption {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-family: var(--font);
  text-align: left;
}

.sheet thead th {
  background: var(--tint);
}

.sheet td,
.sheet th {
  border: 1px solid var(--line);
  white-space: nowrap;
}

.code {
  position: relative;
  margin: 1.25rem 0;
}

pre {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.55;
}

.code .copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 6px;
  background: rgb(255 255 255 / 8%);
  color: var(--code-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
}

.code:hover .copy,
.code .copy:focus-visible {
  opacity: 1;
}

/* highlight.js tokens, tuned for contrast on the dark code background */
.hljs-keyword,
.hljs-literal,
.hljs-built_in,
.hljs-selector-tag {
  color: #ff9e8a;
}

.hljs-string,
.hljs-regexp {
  color: #a5e1a0;
}

.hljs-attr,
.hljs-attribute,
.hljs-property {
  color: #8fd1ff;
}

.hljs-number,
.hljs-bullet {
  color: #f7c97e;
}

.hljs-comment,
.hljs-meta {
  color: #8b98a5;
  font-style: italic;
}

.hljs-title,
.hljs-function,
.hljs-name,
.hljs-tag {
  color: #d2b6ff;
}

.hljs-params,
.hljs-variable {
  color: var(--code-text);
}

/* ---- the designer sketch on the front page --------------------------------------------------------------- */

.designer-sketch {
  max-width: 32rem;
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}

.designer-sketch__row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: center;
  gap: 1rem;
  margin: 0.35rem 0;
  font-size: 0.95rem;
}

.designer-sketch__row > span:first-child {
  color: var(--muted);
  font-weight: 600;
}

.field {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.field--code {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ---- diagram ---------------------------------------------------------------------------------------------- */

.diagram {
  margin: 1rem 0 0;
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.d-box rect {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 2;
}

.d-box--accent rect {
  fill: var(--brand-soft);
  stroke: var(--brand);
}

.diagram text {
  fill: var(--text);
  font-family: var(--font);
  font-size: 16px;
  text-anchor: middle;
}

.diagram .d-head {
  fill: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.diagram .d-small {
  fill: var(--muted);
  font-size: 14px;
}

.d-arrow path {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  marker-end: none;
}

/* ---- documentation ----------------------------------------------------------------------------------------- */

.docs {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr) 13rem;
  align-items: start;
  gap: 2.5rem;
  padding-top: 2.5rem;
}

.docs-nav,
.toc {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
  font-size: 0.95rem;
}

.docs-nav ol,
.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-left: 2px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.docs-nav a:hover {
  border-left-color: var(--brand);
}

.docs-nav a[aria-current="page"] {
  border-left-color: var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
  font-weight: 650;
}

.toc p {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 0.2rem 0;
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--brand);
}

.prose {
  min-width: 0;
  max-width: 48rem;
}

.prose h1 {
  margin: 0 0 1.25rem;
  font-size: 2.4rem;
}

.prose h2 {
  margin: 2.5rem 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 1.6rem;
}

.prose h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.2rem;
}

.prose .anchor {
  margin-left: -1.2rem;
  padding-right: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor {
  opacity: 1;
}

.prose table {
  margin: 1.25rem 0;
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 1rem;
  border-left: 4px solid var(--mint);
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
}

.pager a {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}

.pager a span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.pager__next {
  margin-left: auto;
  text-align: right;
}

.edit {
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

/* ---- playground ----------------------------------------------------------------------------------------------- */

.not-found {
  padding: 4rem 1.25rem;
}

.playground-intro {
  padding-top: 2.5rem;
}

.playground-intro h1 {
  margin: 0 0 0.5rem;
  font-size: 2.4rem;
}

.playground {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
}

.playground > section {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.playground__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--tint);
}

.playground__bar h2 {
  margin: 0;
  font-size: 1rem;
}

.playground__bar label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.playground__bar select {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

#pg-yaml {
  flex: 1;
  min-height: 28rem;
  padding: 1rem;
  border: 0;
  resize: vertical;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.55;
  tab-size: 2;
}

.playground__problems {
  max-height: 12rem;
  padding: 0.6rem 1rem;
  overflow: auto;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.playground__problems ul {
  margin: 0;
  padding-left: 1.25rem;
  color: #c2271a;
}

.playground__problems-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.playground__ok {
  margin: 0;
  color: #1a7f45;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .playground__problems ul {
    color: #ff8f84;
  }

  .playground__ok {
    color: #6fd99a;
  }
}

.playground__frame {
  flex: 1;
  padding: 1.5rem;
  overflow: auto;
  background: #fff;
  color: #0b0c0c;
}

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

.playground__submitted summary {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-weight: 600;
}

.playground__submitted pre {
  margin: 0;
  border-radius: 0;
}

/* ---- small screens ---------------------------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .docs {
    grid-template-columns: 13rem minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .hero__inner,
  .playground {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .docs-nav {
    position: static;
    max-height: none;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .docs-nav ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .docs-nav a {
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .menu-button {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    padding: 0.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .menu-button[aria-expanded="true"] + .site-nav {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
  }

  .designer-sketch__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
