/* Metapane docs: one shell for every page (header, sidebar, page, On this page). Same type and
   colours as the app: Geist, ink on paper, blue for picked, violet for AI. */
@font-face { font-family: Geist; src: url("fonts/Geist-Regular.ttf"); font-weight: 400; font-display: swap; }
@font-face { font-family: Geist; src: url("fonts/Geist-Medium.ttf"); font-weight: 500; font-display: swap; }
@font-face { font-family: Geist; src: url("fonts/Geist-SemiBold.ttf"); font-weight: 600; font-display: swap; }

:root {
  --ink: #0a0a0b;
  --muted: #5f5f66;
  --faint: #8c8c93;
  --edge: rgb(10 10 11 / 0.1);
  --soft: rgb(10 10 11 / 0.045);
  --paper: #ffffff;
  --bg: #f7f6f3;
  --sel: #2563eb;
  --ai: #7c3aed;
  --ad: #92400e;
  --design: #1e40af;
  --motion: #115e59;
  --head: 56px;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head) + 24px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Geist, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sel); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 50; padding: 8px 12px; border-radius: 8px; background: var(--ink); color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { left: 12px; }

/* ---- Header ---- */
.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--head);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--edge);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.brand svg rect { fill: currentColor; }
.brand .docs { font-weight: 500; color: var(--muted); padding-left: 9px; border-left: 1px solid var(--edge); }
.search { position: relative; flex: 0 1 340px; margin-left: 12px; }
.search input {
  width: 100%; height: 34px; padding: 0 56px 0 34px;
  border: 1px solid var(--edge); border-radius: 9px; background: var(--soft);
  font: inherit; font-size: 14px; color: var(--ink);
}
.search input::placeholder { color: var(--faint); }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.search kbd { position: absolute; right: 8px; top: 7px; }
.top .grow { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #26262b; }
.menu-btn { display: none; height: 34px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 9px; background: var(--paper); font: inherit; font-size: 14px; cursor: pointer; }

/* ---- Three columns ---- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; max-width: 1360px; margin: 0 auto; }
.side {
  position: sticky; top: var(--head); align-self: start;
  height: calc(100vh - var(--head)); overflow-y: auto;
  padding: 24px 16px 40px 20px;
  border-right: 1px solid var(--edge);
}
.side h4 { margin: 18px 0 6px; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.side h4:first-child { margin-top: 0; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a, .side li span.soon {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 10px; border-radius: 8px; font-size: 14px; line-height: 1.4; text-decoration: none; color: var(--ink);
}
.side li a:hover { background: var(--soft); }
.side li a[aria-current="page"] { background: rgb(37 99 235 / 0.08); color: var(--design); font-weight: 500; }
.side li span.soon { color: var(--faint); cursor: default; }
.side .later { margin: 18px 0 0; padding: 0 10px; font-size: 12px; color: var(--faint); }
.side li[hidden] { display: none; }
.tag { flex: none; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 18px; background: var(--soft); color: var(--faint); }
.side .none { padding: 6px 10px; font-size: 14px; color: var(--muted); }

.page { padding: 40px 56px 80px; min-width: 0; }
.page > * { max-width: 740px; }
.page > figure, .page > .wide { max-width: 980px; }

.toc { position: sticky; top: var(--head); align-self: start; padding: 40px 20px 40px 8px; font-size: 13px; }
.toc h4 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--edge); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); border-left-color: var(--ink); font-weight: 500; }

/* ---- Page type ---- */
.crumb { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.crumb a { color: var(--muted); text-decoration: none; }
h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; text-wrap: balance; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 28px; text-wrap: pretty; }
h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.01em; margin: 56px 0 12px; padding-top: 8px; text-wrap: balance; }
h3 { font-size: 17px; line-height: 1.35; margin: 28px 0 8px; }
p { margin: 0 0 14px; text-wrap: pretty; }
ul, ol { padding-left: 22px; margin: 0 0 16px; }
li { margin-bottom: 6px; }
b, strong { font-weight: 600; }

figure { margin: 22px 0 26px; }
figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); outline: 1px solid rgb(0 0 0 / 0.1); outline-offset: -1px; background: var(--bg); }
figure.narrow img { width: auto; max-width: 100%; max-height: 560px; }
figure.strip img { border-radius: 10px; }
figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.shot { position: relative; }
.pin {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 0 0 3px #fff, 0 4px 12px rgb(0 0 0 / 0.25);
}

/* Steps: one action each, numbered in circles. */
ol.steps { list-style: none; padding: 0; counter-reset: step; }
ol.steps > li { position: relative; padding-left: 40px; margin-bottom: 18px; counter-increment: step; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--soft); font-size: 13px; font-weight: 600;
}

/* The panes, the page types and the shortcuts. */
dl.terms { display: grid; grid-template-columns: 140px 1fr; gap: 10px 20px; margin: 18px 0 22px; }
dl.terms dt { font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
dl.terms dt .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; }
dl.terms dd { margin: 0; }
.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 22px; }
.type { border: 1px solid var(--edge); border-radius: var(--radius); padding: 14px 16px; }
.type b { display: block; margin-bottom: 2px; }
.type span { font-size: 14px; color: var(--muted); }
.type.ad b { color: var(--ad); }
.type.design b { color: var(--design); }
.type.motion b { color: var(--motion); }
.starts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 6px 0 14px; padding: 0; list-style: none; }
.starts li { margin: 0; font-size: 15px; }

kbd {
  display: inline-block; min-width: 20px; padding: 0 6px; border: 1px solid var(--edge); border-bottom-width: 2px;
  border-radius: 6px; background: var(--paper); font: 500 12px/18px Geist, system-ui, sans-serif; color: var(--ink); text-align: center;
}
table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 12px 0 18px; }
th, td { text-align: start; padding: 9px 12px 9px 0; border-top: 1px solid var(--edge); vertical-align: top; }
th { font-size: 13px; font-weight: 600; color: var(--muted); border-top: 0; }
td:first-child { white-space: nowrap; width: 40%; }

.note { display: flex; gap: 12px; margin: 18px 0 22px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg); font-size: 15px; }
.note::before { content: ""; flex: none; width: 4px; border-radius: 4px; background: var(--faint); }
.note.tip::before { background: var(--ai); }
.note p:last-child { margin-bottom: 0; }
.note b:first-child { margin-right: 4px; }

.next { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 0; }
.next .card { border: 1px solid var(--edge); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); text-decoration: none; }
.next a.card:hover { border-color: rgb(10 10 11 / 0.25); }
.next .card b { display: flex; justify-content: space-between; gap: 8px; }
.next .card span { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.next div.card { color: var(--muted); }

a.next-card, .next a.card { display: block; }

/* ---- Heading links, Copy page ---- */
h2, h3 { position: relative; }
.anchor { margin-left: 8px; color: var(--faint); text-decoration: none; font-weight: 500; opacity: 0; transition: opacity 0.15s; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--sel); }
@media (hover: none) { .anchor { opacity: 0.6; } }
.page-actions { display: flex; justify-content: flex-end; margin: -6px 0 0; height: 0; }
.ghost {
  height: 30px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 8px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.ghost:hover { background: var(--soft); }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; margin: 0; padding: 8px 14px; border-radius: 9px;
  background: var(--ink); color: var(--paper); font-size: 13px; transform: translate(-50%, 12px); opacity: 0;
  pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Bottom of the page ---- */
.helpful { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 64px; padding: 16px 0; border-top: 1px solid var(--edge); font-size: 14px; }
.helpful .q { margin: 0; font-weight: 500; }
.helpful .row { display: flex; gap: 8px; }
.helpful form { display: grid; gap: 8px; width: 100%; }
.helpful label { font-size: 14px; color: var(--muted); }
.helpful textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--edge); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.helpful form .ghost { justify-self: start; }
.helpful .thanks { margin: 0; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.pager .card { display: block; padding: 12px 16px; border: 1px solid var(--edge); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.pager .card:hover { border-color: var(--edge-strong); }
.pager .card span { display: block; font-size: 13px; color: var(--muted); }
.pager .card.is-next { text-align: end; grid-column: 2; }
.helpful [hidden] { display: none; }
.foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--edge); font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); }

/* ---- Overview cards, glossary, changelog ---- */
.tour { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0 28px; }
.tour .item { border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.tour .item img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; background: var(--bg); border-bottom: 1px solid var(--edge); }
.tour .item div { padding: 14px 16px 16px; }
.tour .item b { display: block; margin-bottom: 4px; }
.tour .item p { margin: 0; font-size: 14px; color: var(--muted); }
.page > .tour { max-width: 980px; }
dl.gloss { margin: 12px 0 24px; }
dl.gloss dt { font-weight: 600; margin-top: 16px; }
dl.gloss dd { margin: 2px 0 0; }
dl.gloss dd .aka { display: block; font-size: 14px; color: var(--muted); }
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; padding: 0; list-style: none; }
.letters a { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border: 1px solid var(--edge); border-radius: 8px; font-size: 13px; text-decoration: none; color: var(--ink); }
.release { margin: 0 0 8px; }
.release .date { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.label { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 1px; }
.label.new { background: rgb(37 99 235 / 0.1); color: var(--design); }
.label.better { background: rgb(17 94 89 / 0.1); color: var(--motion); }
.label.fix { background: rgb(146 64 14 / 0.1); color: var(--ad); }
code { padding: 1px 5px; border-radius: 5px; background: var(--soft); font-size: 0.9em; }

/* ---- Dark mode, following the system ---- */
/* Dark theme: set on <html data-theme="dark"> by the head script (the reader's pick, else the system's). */
:root[data-theme="dark"] {
  --ink: #ededef; --muted: #a1a1aa; --faint: #71717a;
  --edge: rgb(255 255 255 / 0.1); --soft: rgb(255 255 255 / 0.06);
  --paper: #0f0f11; --bg: #18181b; --sel: #60a5fa;
  --ad: #fbbf24; --design: #93c5fd; --motion: #5eead4; --ai: #a78bfa;
  color-scheme: dark;
}
[data-theme="dark"] .top { background: rgb(15 15 17 / 0.9); }
[data-theme="dark"] .btn.dark { background: var(--ink); color: #0f0f11; }
[data-theme="dark"] .btn.dark:hover { background: #fff; }
[data-theme="dark"] .pin, [data-theme="dark"] dl.terms dt .n { background: #ededef; color: #0f0f11; box-shadow: 0 0 0 3px #0f0f11, 0 4px 12px rgb(0 0 0 / 0.5); }
[data-theme="dark"] .side li a[aria-current="page"] { background: rgb(96 165 250 / 0.12); }
[data-theme="dark"] figure img, [data-theme="dark"] .tour .item img { outline-color: rgb(255 255 255 / 0.1); }

/* Copy page: a split button with a menu. */
.split { position: relative; display: inline-flex; }
.split .ghost { display: inline-flex; align-items: center; gap: 6px; }
.split .main { border-radius: 8px 0 0 8px; }
.split .more { border-radius: 0 8px 8px 0; border-left: 0; padding: 0 8px; }
.split .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 280px; padding: 6px;
  border: 1px solid var(--edge); border-radius: 12px; background: var(--paper); color: var(--ink);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.14);
}
.split .menu[hidden] { display: none; }
.split .menu [role="menuitem"] {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--ink); font: inherit; text-align: start; text-decoration: none; cursor: pointer;
}
.split .menu [role="menuitem"]:hover, .split .menu [role="menuitem"]:focus-visible { background: var(--soft); outline: none; }
.split .menu b { display: block; font-size: 14px; font-weight: 500; }
.split .menu span { display: block; font-size: 12px; color: var(--muted); }
@media (max-width: 820px) { .split .menu { right: auto; left: 0; } }

/* Light / dark switch in the header: one button, two states. */
.theme-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--edge); border-radius: 9px; background: var(--paper); color: var(--ink); cursor: pointer; }
.theme-btn:hover { background: var(--soft); }
.theme-btn .moon { display: none; }
[data-theme="dark"] .theme-btn .sun { display: none; }
[data-theme="dark"] .theme-btn .moon { display: block; }
:root { --edge-strong: rgb(127 127 127 / 0.4); }
@media (max-width: 820px) {
  .page-actions { height: auto; margin: 0 0 12px; justify-content: flex-start; }
  .pager { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  td:first-child { white-space: normal; width: auto; min-width: 110px; }
  .pager .card.is-next { grid-column: 1; }
}

@media print {
  .top, .side, .toc, .page-actions, .helpful, .pager, .anchor { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; }
}

/* ---- Smaller screens ---- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
  .page { padding: 36px 40px 72px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; position: fixed; inset: var(--head) 0 0 0; align-self: stretch; z-index: 15; height: auto; background: var(--paper); border-right: 0; }
  body.nav-open .side { display: block; }
  .menu-btn { display: inline-block; }
  .search { display: none; }
  .page { padding: 28px 20px 64px; }
  h1 { font-size: 30px; }
  .types, .next, .starts, .tour { grid-template-columns: 1fr; }
  dl.terms { grid-template-columns: 1fr; gap: 2px 0; }
  dl.terms dd { margin-bottom: 10px; }
  .top .btn .long { display: none; }
  .top { gap: 10px; padding: 0 14px; }
  /* The spacer's own gap pushed the header past the edge on phones; an auto margin does its job. */
  .top .grow { display: none; }
  .top .theme-btn { margin-left: auto; }
}
@media (max-width: 400px) {
  .brand .docs { display: none; }
}
