/* Paperkites docs. The tokens and pieces the landing page (index.html) uses inline,
   gathered once so every docs page shares them. Light only, like the landing page. */

:root {
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --surface-page: #fcfcfc;
  --surface-raised: #ffffff;
  --surface-sunken: #f9f9f9;
  --surface-muted: #f0f0f0;
  --surface-code: #f4f4f4;
  --ink: #202020;
  --ink-secondary: #424242;
  --ink-label: #6e6e6e;
  --ink-muted: #838383;
  --kite: #c2622f;
  --kite-text: #a8541f;
  --kite-chip: #f6e3d6;
  --focus-ring: #5aabf3;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(32, 32, 32, 0.06), 0 0 0 1px rgba(32, 32, 32, 0.05);
  --shadow-md: 0 4px 12px rgba(32, 32, 32, 0.08), 0 0 0 1px rgba(32, 32, 32, 0.05);

  --duration: 200ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--surface-page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  padding-bottom: 62px;
}

a { color: var(--kite-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
::selection { background: rgba(194, 98, 47, 0.18); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-xs); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Nav: the landing page's, brand left, links right */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1120px; margin: 0 auto; padding: 20px 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand svg { display: block; flex: 0 0 auto; }
.nav-links { display: flex; align-items: center; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius-full); font-family: var(--font-sans); font-weight: 500; text-decoration: none; cursor: pointer; transition: box-shadow var(--duration) var(--ease-out), color var(--duration) var(--ease-out); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 14px; }
.btn-ghost { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { color: var(--ink); box-shadow: var(--shadow-md); }
.btn[aria-current] { box-shadow: 0 0 0 1.5px var(--ink); }

/* The menu button opens the page list at phone width; beside the column it's always there, so the popover's
   own hiding and top-layer box are undone */
.menu-btn { display: none; }
.toc[popover] { display: block; position: static; inset: auto; margin: 0; padding: 0; border: 0; width: auto; height: auto; overflow: visible; background: none; color: inherit; }

/* Layout: a list of pages beside one reading column */
.docs { display: flex; gap: 56px; max-width: 1120px; margin: 0 auto; padding: 48px 24px 120px; }
.toc { flex: 0 0 200px; }
.toc-inner { position: sticky; top: 24px; }
.toc-label { font-family: var(--font-mono); font-size: 12px; color: var(--ink-label); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: block; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 15px; line-height: 1.5; color: var(--ink-secondary); text-decoration: none; }
.toc a:hover { color: var(--ink); background: var(--surface-muted); }
.toc a[aria-current="page"] { color: var(--ink); background: var(--surface-muted); font-weight: 500; }
.toc .soon-link { color: var(--kite-text); }

.content { flex: 1 1 auto; min-width: 0; max-width: 700px; }

.eyebrow { font-family: var(--font-mono); font-size: 12px; color: var(--ink-label); }
.content h1 { margin: 16px 0 0; font-size: clamp(34px, 5vw, 52px); font-weight: 500; line-height: 1.05; letter-spacing: -0.035em; }
.content h1 .dot { color: var(--kite); }
.lede { margin: 20px 0 0; font-size: 19px; line-height: 1.65; color: var(--ink-secondary); text-wrap: pretty; }

.content h2 { margin: 64px 0 0; font-size: 26px; font-weight: 500; line-height: 1.25; letter-spacing: -0.015em; scroll-margin-top: 24px; }
.content h3 { margin: 36px 0 0; font-size: 19px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; scroll-margin-top: 24px; }
.content p, .content ul, .content ol { margin: 16px 0 0; color: var(--ink-secondary); text-wrap: pretty; }
.content ul, .content ol { padding-left: 22px; }
.content li + li { margin-top: 6px; }
.content strong { color: var(--ink); font-weight: 600; }

.content code { padding: 1px 6px; border-radius: 5px; background: var(--surface-muted); font-family: var(--font-mono); font-size: 0.84em; color: var(--ink); overflow-wrap: anywhere; }
.content kbd { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: var(--radius-full); background: var(--surface-raised); box-shadow: var(--shadow-sm); font-family: var(--font-mono); font-size: 12px; line-height: 1; color: var(--ink); white-space: nowrap; vertical-align: 1px; }

.content pre { margin: 20px 0 0; padding: 18px 20px; border-radius: var(--radius-md); background: var(--surface-code); overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.65; color: var(--ink); }
.content pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }

/* Tables: a raised card, rows told apart by tint, never by rules */
.table-wrap { margin: 20px 0 0; border-radius: var(--radius-md); background: var(--surface-raised); box-shadow: var(--shadow-sm); overflow-x: auto; }
.content table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.content th { padding: 12px 16px 8px; text-align: left; font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--ink-label); white-space: nowrap; }
.content td { padding: 9px 16px; vertical-align: top; color: var(--ink-secondary); }
.content tbody tr:nth-child(odd) td { background: var(--surface-sunken); }
.content td:first-child { width: 1%; white-space: nowrap; color: var(--ink); }
.content th:first-child { width: 1%; }
.content td:first-child kbd + kbd { margin-left: 2px; }

/* A note that something isn't in the app yet */
.soon { margin: 24px 0 0; padding: 18px 20px; border-radius: var(--radius-md); background: var(--kite-chip); color: var(--ink-secondary); }
.soon p:first-child { margin-top: 0; }
.soon .tag { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: var(--radius-full); background: var(--kite-text); color: #ffffff; font-family: var(--font-mono); font-size: 12px; line-height: 22px; letter-spacing: 0.02em; vertical-align: 1px; }

/* A warning that can't be missed: a pale rose ground, a dashed red border, dark ink */
.warn { margin: 24px 0 0; padding: 18px 20px; border: 2px dashed #dc2626; border-radius: var(--radius-md); background: #fff1f3; color: #1f1f1f; }
.warn p { margin: 0; color: #1f1f1f; }
.warn strong { color: #1f1f1f; }

/* Page cards on the docs home */
.content .cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; margin: 24px 0 0; padding: 0; }
.content .cards li + li { margin-top: 0; }
.cards a { display: block; height: 100%; padding: 18px 20px; border-radius: var(--radius-md); background: var(--surface-raised); box-shadow: var(--shadow-sm); color: var(--ink-secondary); text-decoration: none; font-size: 15px; line-height: 1.55; transition: box-shadow var(--duration) var(--ease-out); }
.cards a:hover { box-shadow: var(--shadow-md); color: var(--ink-secondary); }
.cards strong { display: block; margin-bottom: 4px; font-size: 17px; font-weight: 500; color: var(--ink); }

/* Previous / next */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 80px 0 0; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--surface-raised); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; font-size: 15px; }
.pager a:hover { box-shadow: var(--shadow-md); color: var(--ink); }
.pager span { font-family: var(--font-mono); font-size: 12px; color: var(--ink-label); }
.pager .next { margin-left: auto; text-align: right; }

/* Page footer: the copyright and whose product it is, as on the landing page */
.site-footer { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin: 64px 0 0; font-family: var(--font-mono); font-size: 12px; color: var(--ink-label); }
.site-footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-label); text-decoration: none; }
.site-footer a span { color: var(--ink); }
.site-footer img { display: block; height: 28px; width: auto; }

/* Footer: the landing page's status line */
.statusline { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); z-index: 50; display: flex; align-items: center; gap: 14px; height: 30px; padding: 0 12px 0 0; border-radius: var(--radius-md); background: var(--surface-muted); box-shadow: var(--shadow-sm); font-family: var(--font-mono); font-size: 12px; color: var(--ink-secondary); white-space: nowrap; overflow: hidden; }
.statusline .mode { display: inline-flex; align-items: center; height: 100%; padding: 0 12px; background: var(--kite-text); color: #ffffff; font-weight: 500; letter-spacing: 0.04em; }
.statusline .name { color: var(--ink); }
.statusline .file { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.statusline .gap { flex: 1; }
.statusline a { color: var(--kite-text); }

/* Phone width: the page list goes above the column */
@media (max-width: 860px) {
  .docs { flex-direction: column; gap: 32px; padding: 24px 16px 96px; }
  .nav { padding: 16px; }
  /* the page list is a popover the menu button opens: tap outside or esc closes it */
  .menu-btn { display: inline-flex; width: 32px; padding: 0; order: 1; } /* last, at the right edge */
  .toc[popover] { position: fixed; inset: 64px 16px auto auto; margin: 0; width: min(280px, calc(100vw - 32px)); max-height: calc(100vh - 88px); overflow: auto; padding: 12px; border: 0; border-radius: var(--radius-md); background: var(--surface-raised); color: inherit; box-shadow: var(--shadow-md); }
  .toc[popover]::backdrop { background: rgb(0 0 0 / 0.08); }
  .toc[popover]:not(:popover-open) { display: none; }
  .toc-inner { position: static; }
  .content h2 { margin-top: 48px; }
  .content td:first-child { white-space: normal; }
  .statusline .file { display: none; }
}

/* Page changes cross-fade instead of blinking (cross-document view transitions; browsers without them just
   navigate). The site nav and the page list hold still; only the reading column fades. */
@view-transition {
  navigation: auto;
}
.nav {
  view-transition-name: site-nav;
}
.toc {
  view-transition-name: docs-toc;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: ease-out;
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
