/* The documentation site. Colors, type, and spacing are AppWren's own design tokens
   (tokens.css, copied in by the build), so the site follows light and dark as the app does. */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15.5px/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
/* The signature: the application's band, mostly the accent with a stretch of its second color. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 30;
  background: linear-gradient(90deg, var(--accent) 0 72%, var(--signature) 72% 100%);
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface-1); padding: 8px 12px; z-index: 40; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4);
  height: 60px; padding: 3px var(--space-5) 0; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand .version { font: 500 12px var(--font-mono); color: var(--text-subtle); padding: 2px 7px; border: 1px solid var(--border); border-radius: var(--radius-full); }
.search { position: relative; flex: 0 1 380px; margin-left: auto; }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 12px; border: 1px solid var(--control-border); border-radius: var(--radius-m);
  background: var(--surface-1); color: var(--text); font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--text-subtle); opacity: 1; }
.search input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.search kbd { position: absolute; right: 9px; top: 8px; font: 12px var(--font-mono); color: var(--text-subtle); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.results {
  position: absolute; top: 42px; left: 0; right: 0; max-height: 70vh; overflow: auto; z-index: 30;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius-l); box-shadow: var(--shadow-3); padding: 6px;
}
.results a { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--radius-m); color: var(--text); text-decoration: none; }
.results a:hover, .results a.active { background: var(--accent-soft); }
.results strong { font-size: 14px; }
.results .where { font-size: 12px; color: var(--accent); }
.results .snippet { font-size: 13px; color: var(--text-muted); }
.results .none { margin: 8px 10px; color: var(--text-muted); font-size: 14px; }
.theme { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-full); padding: 2px; }
.theme button { border: 0; background: none; color: var(--text-muted); width: 30px; height: 26px; border-radius: var(--radius-full); cursor: pointer; font-size: 14px; }
.theme button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.github { color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 550; }
.menu-button { display: none; border: 1px solid var(--control-border); background: var(--surface-1); color: var(--text); border-radius: var(--radius-m); width: 36px; height: 34px; font-size: 16px; cursor: pointer; }

/* Layout: menu, content, and "on this page" */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 220px; gap: var(--space-8); max-width: 1320px; margin: 0 auto; padding: 0 var(--space-6); }
.menu { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow: auto; padding: var(--space-6) 0; }
.menu-group + .menu-group { margin-top: var(--space-5); }
.menu-title { font: 600 11.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); margin: 0 0 6px 10px; }
.toc .menu-title { margin-left: 0; }
.menu ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.menu a { display: block; padding: 5px 10px; border-radius: var(--radius-m); color: var(--text-muted); text-decoration: none; font-size: 14.5px; }
.menu a:hover { color: var(--text); background: var(--surface-2); }
.menu a[aria-current="page"] { color: var(--accent-hover); background: var(--accent-soft); font-weight: 600; }
.toc { position: sticky; top: 60px; align-self: start; padding: var(--space-6) 0; max-height: calc(100vh - 60px); overflow: auto; font-size: 13.5px; }
.toc a { display: block; padding: 3px 0; color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.toc .l3 a { padding-left: 12px; font-size: 13px; }
.content { min-width: 0; padding: var(--space-7) 0 var(--space-9); max-width: 780px; }

/* Text */
.content h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 var(--space-5); font-weight: 700; }
.content h2 { font-size: 23px; line-height: 1.3; letter-spacing: -0.01em; margin: var(--space-8) 0 var(--space-3); padding-top: var(--space-5); border-top: 1px solid var(--border); font-weight: 650; }
.content h3 { font-size: 18px; margin: var(--space-6) 0 var(--space-2); font-weight: 650; }
.content h4 { font-size: 15.5px; margin: var(--space-5) 0 var(--space-2); }
.anchor { margin-left: 8px; color: var(--text-subtle); text-decoration: none; opacity: 0; font-weight: 400; }
:is(h2, h3, h4):hover .anchor, .anchor:focus { opacity: 1; }
.content ul, .content ol { padding-left: 1.4em; }
.content li + li { margin-top: 4px; }
code { font: 0.88em var(--font-mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.code { position: relative; margin: var(--space-4) 0; }
pre { margin: 0; padding: 14px 16px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m); font-size: 13.5px; line-height: 1.55; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
:not(pre) > code { overflow-wrap: anywhere; }
.copy { position: absolute; top: 8px; right: 8px; min-height: 26px; border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-muted); border-radius: var(--radius-s); font: 12px var(--font); padding: 3px 8px; cursor: pointer; opacity: 0; transition: opacity var(--fast); }
.code:hover .copy, .copy:focus { opacity: 1; }
blockquote { margin: var(--space-4) 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-m) var(--radius-m) 0; }
blockquote p { margin: 6px 0; }
.table-wrap { overflow-x: auto; margin: var(--space-4) 0; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface-1); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; background: var(--surface-2); color: var(--text-muted); font-size: 13px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-7) 0; }
figure { margin: var(--space-6) 0; }
figure a { display: block; border-radius: var(--radius-m); }
figure img { display: block; width: 100%; height: auto; border: 1px solid var(--border-strong); border-radius: var(--radius-m); box-shadow: var(--shadow-2); }
figcaption { margin-top: 8px; font-size: 13.5px; color: var(--text-muted); text-align: center; }
.only-dark { display: none !important; }
:root[data-theme="dark"] .only-light { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-light { display: none !important; }
  :root:not([data-theme="light"]) .only-dark { display: block !important; }
}
.muted { color: var(--text-muted); }

/* API reference */
.endpoint { padding-top: var(--space-2); }
.endpoint h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; }
.endpoint h3 code { font-size: 14px; overflow-wrap: anywhere; }
.method { font: 700 11.5px var(--font-mono); letter-spacing: 0.04em; padding: 3px 7px; border-radius: 5px; color: var(--on-accent); background: var(--info); }
.method-post, .method-put, .method-patch { background: var(--accent); }
.method-delete { background: var(--danger); }
.fields { table-layout: fixed; min-width: 560px; }
.fields-5 th:nth-child(1) { width: 26%; } .fields-5 th:nth-child(2) { width: 9%; } .fields-5 th:nth-child(3) { width: 16%; } .fields-5 th:nth-child(4) { width: 12%; }
.fields-4 th:nth-child(1) { width: 26%; } .fields-4 th:nth-child(2) { width: 20%; } .fields-4 th:nth-child(3) { width: 12%; }
.fields td { overflow-wrap: anywhere; }
.fields td code { white-space: normal; }

/* Pager and footer */
.pager { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-9); }
.pager a { display: grid; gap: 2px; padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-m); text-decoration: none; color: var(--text); font-weight: 600; min-width: 200px; background: var(--surface-1); }
.pager a:hover { border-color: var(--accent); }
.pager span { font-size: 12px; font-weight: 500; color: var(--text-subtle); }
.pager .next { text-align: right; margin-left: auto; }
.foot { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--border); font-size: 13px; color: var(--text-subtle); }

/* Small screens */
@media (max-width: 1180px) { .layout { grid-template-columns: 230px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .menu-button { display: block; flex: none; }
  .menu { display: none; position: fixed; inset: 60px 0 0 0; z-index: 15; background: var(--surface-1); padding: var(--space-5) 16px; max-height: none; }
  .menu a { padding: 9px 10px; font-size: 16px; }
  .menu-open .menu { display: block; }
  .menu-open { overflow: hidden; }
  .top { gap: var(--space-3); padding: 3px 12px 0; }
  .brand .version, .github, .search kbd { display: none; }
  .search { flex: 1 1 auto; min-width: 0; }
  .theme { flex: none; }
  .content h1 { font-size: 28px; }
  .pager { flex-direction: column; }
  .pager a { min-width: 0; }
}
@media (max-width: 420px) { .brand span:not(.version) { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* The home page */
.page-index .layout { grid-template-columns: 240px minmax(0, 1fr); }
.page-index .toc { display: none; }
.page-index .content { max-width: 1060px; }
.page-index .content h2 { border: 0; padding: 0; font-size: 27px; line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 var(--space-3); }
.eyebrow { margin: 0 0 10px; font: 600 12.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.hero { padding: var(--space-6) 0 var(--space-4); }
.hero h1 { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 var(--space-4); max-width: 15em; text-wrap: balance; }
.hero .lead { font-size: 18.5px; line-height: 1.6; color: var(--text-muted); max-width: 44em; margin: 0 0 var(--space-5); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--space-7); }
.button { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: var(--radius-m); border: 1px solid var(--control-border); color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; background: var(--surface-1); }
.button:hover { border-color: var(--accent); color: var(--text); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
figure.shot { margin: 0; }
figure.shot img { border-radius: var(--radius-l); box-shadow: var(--shadow-3); }
.principles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); margin: var(--space-10) 0; }
.principles h2 { font-size: 16px !important; letter-spacing: 0 !important; margin: 0 0 6px !important; }
.principles p { margin: 0; font-size: 14.5px; color: var(--text-muted); }
.principles > div { padding-top: var(--space-4); border-top: 3px solid var(--accent); }
.principles > div:nth-child(even) { border-color: var(--signature); }
.feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-8); align-items: center; margin: var(--space-10) 0; }
.feature.flip .feature-text { order: 2; }
.feature p { color: var(--text-muted); margin: 0 0 var(--space-3); }
.feature ul { margin: 0; color: var(--text-muted); }
.feature .more { font-weight: 600; font-size: 15px; }
.section { margin: var(--space-10) 0; }
.section > p { color: var(--text-muted); max-width: 46em; }
.rest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5) var(--space-6); margin-top: var(--space-5); }
.rest h3 { font-size: 15.5px; margin: 0 0 4px; }
.rest p { margin: 0; font-size: 14.5px; color: var(--text-muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.cards a { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-m); text-decoration: none; background: var(--surface-1); }
.cards a:hover { border-color: var(--accent); }
.cards strong { color: var(--text); font-size: 15px; }
.cards span { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; }
@media (max-width: 1180px) { .page-index .layout { grid-template-columns: 230px minmax(0, 1fr); } }
@media (max-width: 960px) {
  .feature { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); margin: var(--space-9) 0; }
  .feature.flip .feature-text { order: 0; }
  .principles, .rest { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) { .page-index .layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .principles, .rest { grid-template-columns: minmax(0, 1fr); } }
