/* The documentation site in the Studio Desk look (tools/para/studio/index.html): the same royal
   purple and Nim gold, Nunito for text and Fredoka for headings (both SIL OFL 1.1, served from
   assets/fonts/, nothing fetched from anywhere else), big rounded shapes and Pip. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/nunito-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }

/* The Studio's tokens, unchanged; --code-bg is the one addition. */
:root {
  color-scheme: light dark;
  --sidebar: #F7F5FB; --bg: #FFFFFF; --surface: #F3F0F8; --surface-2: #EBE6F4; --line: #DCD5E8;
  --ink: #1E1433; --mute: #5E5673;
  --accent: #2A1B47; --accent-hover: #3D2A66; --on-accent: #FFE953; --link: #7A5C00; --focus: #9C7C00;
  --selected: #FFF6C7; --pop: 0 10px 32px rgba(30, 20, 51, .16); --scrim: rgba(30, 20, 51, .3);
  --purple: #2A1B47; --gold: #FFE953; --gold-deep: #F3D400; --lilac: #E4DBF5;
  --code-bg: #F3F0F8;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fredoka", "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sidebar: #140D22; --bg: #1C1330; --surface: #2A1F45; --surface-2: #33284F; --line: #46396B;
    --ink: #EFEAF7; --mute: #B1A6C9;
    --accent: #FFE953; --accent-hover: #F3D400; --on-accent: #2A1B47; --link: #FFE953; --focus: #FFE953;
    --selected: #2C2433; --pop: 0 10px 32px rgba(0, 0, 0, .5); --scrim: rgba(10, 6, 20, .6);
    --lilac: #33284F; --code-bg: #140D22;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --sidebar: #140D22; --bg: #1C1330; --surface: #2A1F45; --surface-2: #33284F; --line: #46396B;
  --ink: #EFEAF7; --mute: #B1A6C9;
  --accent: #FFE953; --accent-hover: #F3D400; --on-accent: #2A1B47; --link: #FFE953; --focus: #FFE953;
  --selected: #2C2433; --pop: 0 10px 32px rgba(0, 0, 0, .5); --scrim: rgba(10, 6, 20, .6);
  --lilac: #33284F; --code-bg: #140D22;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
a { color: var(--link); font-weight: 700; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 10px 18px; border-radius: 14px; }
.skip:focus { top: 12px; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ib { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; color: var(--mute); flex: none; }
.ib:hover, .ib[aria-expanded="true"] { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.theme-ic { display: none; }
:root:not([data-theme]) .theme-ic.i-auto, :root[data-theme="light"] .theme-ic.i-light, :root[data-theme="dark"] .theme-ic.i-dark { display: block; }

/* Pip, the parakeet: always on a purple tile, so the gold reads the same in light and dark. */
.pip-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.pip-tile { display: inline-grid; place-items: center; background: var(--purple); flex: none; width: 52px; height: 52px; border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--gold) 35%, transparent); box-shadow: 0 3px 0 color-mix(in srgb, var(--purple) 50%, #000); }
.pip-tile .pip { width: 94%; height: 94%; }
.pip { display: block; overflow: visible; }
.pip .eye { transform-box: fill-box; transform-origin: 50% 50%; }
.pip .bird { transform-origin: 60px 112px; }
.pip .mouth { transform: scaleY(.05); transform-box: fill-box; transform-origin: 50% 0%; }

/* the top bar */
.top { position: sticky; top: 0; z-index: 20; height: 76px; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 2px solid var(--line); }
.menu { display: none; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); border-radius: 18px; padding: 4px 10px 4px 4px; flex: none; }
.brand:hover { background: var(--surface); }
.brand .name { display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font: 600 24px/1.05 var(--display); }
.brand small { color: var(--mute); font-size: 14px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.search { position: relative; flex: 1; max-width: 560px; margin-left: auto; display: flex; align-items: center; }
.search > .ic { position: absolute; left: 16px; color: var(--mute); pointer-events: none; }
.search input { width: 100%; min-height: 48px; font: inherit; font-size: 16.5px; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 0 44px 0 48px; }
.search input::placeholder { color: var(--mute); }
.search input:focus { outline: 0; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); background: var(--bg); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 12px; font: 800 13px/1 var(--font); color: var(--mute); border: 2px solid var(--line); border-radius: 8px; padding: 4px 8px; pointer-events: none; }
.search input:focus ~ kbd { display: none; }
.results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bg); border: 2px solid var(--line); border-radius: 22px; box-shadow: var(--pop); padding: 8px; max-height: min(70vh, 560px); overflow-y: auto; z-index: 30; }
.results ul { list-style: none; margin: 0; padding: 0; }
.results li a { display: block; padding: 10px 14px; border-radius: 14px; color: var(--ink); text-decoration: none; font-weight: 400; }
.results li a b { display: block; font-weight: 800; }
.results li a small { display: block; color: var(--mute); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results li a mark { background: var(--selected); color: inherit; border-radius: 4px; padding: 0 2px; }
.results li[aria-selected="true"] a, .results li a:hover { background: var(--selected); box-shadow: inset 3px 0 0 var(--focus); }
.results .none { padding: 12px 14px; color: var(--mute); margin: 0; }

/* the page: navigation, content, "on this page" */
.layout { display: grid; grid-template-columns: 288px minmax(0, 1fr) 240px; align-items: start; }
.no-toc .layout { grid-template-columns: 288px minmax(0, 1fr); }
.side { position: sticky; top: 76px; height: calc(100vh - 76px); overflow-y: auto; background: var(--sidebar); border-right: 2px solid var(--line); padding: 14px 12px 28px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.side-x { display: none; }
.label { font: 800 12.5px/1.2 var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin: 18px 10px 6px; }
.side .label:first-of-type { margin-top: 6px; }
.page-home .doc > p > img:only-child { max-width: 60rem; width: 100%; margin: 0 auto 6px; }
.side ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 14px; font-size: 16px; line-height: 1.3; color: var(--ink); text-decoration: none; font-weight: 700; }
.row:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.row[aria-current="page"] { background: var(--selected); box-shadow: inset 3px 0 0 var(--focus); font-weight: 800; }
:root[data-theme="dark"] .row[aria-current="page"] { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .row[aria-current="page"] { color: var(--gold); } }
main { min-width: 0; padding: 28px clamp(16px, 4vw, 56px) 40px; outline: 0; }
.toc { position: sticky; top: 76px; max-height: calc(100vh - 76px); overflow-y: auto; padding: 22px 16px 24px 4px; font-size: 14.5px; }
.toc .label { margin: 0 0 8px 10px; }
.toc a { display: block; padding: 5px 10px; border-radius: 10px; color: var(--mute); text-decoration: none; font-weight: 700; line-height: 1.35; }
.toc a:hover { color: var(--ink); background: var(--surface); }
.toc .l3 a { padding-left: 24px; font-weight: 400; }

/* the content */
.doc { max-width: 50rem; margin: 0 auto; }
.doc h1, .doc h2, .doc h3, .doc h4 { font-family: var(--display); font-weight: 600; line-height: 1.15; letter-spacing: .005em; }
.doc h1 { font-size: clamp(32px, 5vw, 44px); margin: 4px 0 18px; }
.doc h2 { font-size: clamp(25px, 3.4vw, 30px); margin: 44px 0 12px; padding-top: 18px; border-top: 2px solid var(--line); }
.doc h3 { font-size: 22px; margin: 30px 0 10px; }
.doc h4 { font-size: 19px; margin: 24px 0 8px; }
.doc h1 code, .doc h2 code, .doc h3 code { font-size: .72em; padding: .04em .3em; vertical-align: .08em; }
.doc p, .doc ul, .doc ol { margin: 0 0 16px; }
.doc li { margin: 4px 0; }
.doc li > p { margin: 0 0 8px; }
.doc ul ul, .doc ol ul, .doc ul ol { margin: 4px 0; }
.doc hr { border: 0; border-top: 2px dashed var(--line); margin: 36px 0; }
.doc blockquote { margin: 0 0 16px; padding: 12px 18px; border-left: 4px solid var(--gold-deep); background: var(--surface); border-radius: 0 18px 18px 0; }
.doc img { display: block; max-width: 100%; height: auto; margin: 20px auto; border: 2px solid var(--line); border-radius: 22px; box-shadow: var(--pop); }
code, pre { font-family: var(--mono); }
code { font-size: .86em; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .08em .38em; overflow-wrap: anywhere; }
a code { color: inherit; }
pre { background: var(--code-bg); border: 2px solid var(--line); border-radius: 20px; padding: 16px 20px; overflow-x: auto; font-size: 14.5px; line-height: 1.55; margin: 0 0 18px; tab-size: 4; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; white-space: pre; }
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 2px solid var(--line); border-radius: 20px; }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--surface); font-weight: 800; }
tr:last-child td { border-bottom: 0; }
td code { overflow-wrap: normal; white-space: nowrap; }

/* the home page */
.hero { max-width: 60rem; margin: 6px auto 26px; display: flex; align-items: center; gap: 28px; padding: 26px 30px; border-radius: 34px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--purple), #45306F); color: #EFEAF7; box-shadow: 0 6px 0 color-mix(in srgb, var(--purple) 60%, #000); }
.hero::before { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 233, 83, .12); }
.hero .pip-tile.big { width: 176px; height: 176px; border-radius: 56px; border-width: 3px; background: rgba(255, 255, 255, .08); box-shadow: none; }
.hero-tx { position: relative; min-width: 0; }
.hero h1 { font: 600 clamp(38px, 6vw, 56px)/1.05 var(--display); color: var(--gold); margin: 0 0 10px; }
.hero p { margin: 0; font-size: 20px; line-height: 1.5; color: #EFEAF7; max-width: 36rem; }
.hero a { color: var(--gold); }
.page-home .doc { max-width: 60rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.page-home .doc > :not(.card) { grid-column: 1 / -1; }
.page-home .card { background: var(--bg); border: 2px solid var(--line); border-radius: 26px; padding: 20px 22px 6px; min-width: 0; }
.page-home .card:nth-of-type(n+3) { grid-column: 1 / -1; }
.page-home .card h2 { margin: 0 0 10px; padding: 0; border: 0; font-size: 25px; }
.page-home .card:first-of-type { background: var(--selected); border-color: color-mix(in srgb, var(--gold-deep) 60%, var(--line)); }
:root[data-theme="dark"] .page-home .card:first-of-type { background: var(--surface); border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .page-home .card:first-of-type { background: var(--surface); border-color: var(--line); } }

/* previous / next, and the foot */
.pager { max-width: 50rem; margin: 40px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.page-home .pager { max-width: 60rem; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 20px; border: 2px solid var(--line); border-radius: 22px; text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--focus); background: var(--surface); }
.pager small { color: var(--mute); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.pager span { font: 600 19px/1.25 var(--display); }
.pager .next { grid-column: 2; text-align: right; }
.foot { max-width: 50rem; margin: 30px auto 0; padding-top: 16px; border-top: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--mute); font-size: 14.5px; }
.page-home .foot { max-width: 60rem; }
.scrim { display: none; }

@media (max-width: 1240px) {
  .layout, .no-toc .layout { grid-template-columns: 272px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .layout, .no-toc .layout { grid-template-columns: minmax(0, 1fr); }
  .menu { display: inline-grid; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: 300px; max-width: 88%; z-index: 40; padding-top: 60px; transform: translateX(-100%); visibility: hidden; box-shadow: var(--pop); }
  body.drawer-open .side { transform: none; visibility: visible; }
  .side-x { display: inline-grid; position: absolute; right: 8px; top: 8px; }
  .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 35; }
  .page-home .doc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .top { height: auto; flex-wrap: wrap; padding: 8px 16px 10px; gap: 6px 4px; }
  .brand { padding: 2px 6px 2px 2px; margin-right: auto; }
  .brand .pip-tile { width: 46px; height: 46px; border-radius: 16px; }
  .brand b { font-size: 21px; }
  .search { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .search kbd { display: none; }
  html { scroll-padding-top: 140px; }
  .side { padding-top: 60px; }
  main { padding: 20px 16px 32px; }
  .hero { flex-direction: column; text-align: center; gap: 16px; padding: 24px 18px; border-radius: 28px; }
  .hero .pip-tile.big { width: 140px; height: 140px; border-radius: 44px; }
  .hero p { font-size: 18px; }
  .page-home .card { padding: 16px 16px 4px; border-radius: 22px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  pre { padding: 14px; border-radius: 16px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: no-preference) {
  .pip[data-state="idle"] .bird { animation: pip-bob 3.4s ease-in-out infinite; }
  .pip[data-state="idle"] .eye { animation: pip-blink 4.2s infinite; }
  .side { transition: transform .2s ease, visibility 0s linear .2s; }
  body.drawer-open .side { transition: transform .2s ease, visibility 0s; }
  .row, .pager a, .brand { transition: background-color .12s, border-color .12s; }
}
@keyframes pip-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes pip-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@media print {
  .top, .side, .toc, .pager, .scrim, .skip { display: none !important; }
  .layout { display: block; }
}
