/* aikido theme for docs-builder. tokens measured from help.aikido.dev, see markup in index.tsx */

:root {
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --primary: rgb(116 96 249);
  --primary-hover: rgb(96 74 235);
  --on-primary: #fff;
  --text: rgb(28 28 35);
  --text-muted: rgb(28 28 35 / 0.64);
  --text-subtle: rgb(106 107 140);
  --bg: #fff;
  --header-bg: rgb(255 255 255 / 0.88);
  --tint: rgb(246 246 255);
  --tint-subtle: rgb(249 249 254);
  --border: rgb(213 214 243);
  --border-subtle: rgb(226 227 252);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --hint-info-bg: rgb(247 247 247);
  --hint-info-fg: rgb(120 120 120);
  --hint-success-bg: rgb(238 252 240);
  --hint-success-fg: rgb(0 201 80);
  --hint-warning-bg: rgb(255 245 236);
  --hint-warning-fg: rgb(254 154 0);
  --hint-danger-bg: rgb(255 242 239);
  --hint-danger-fg: rgb(251 44 54);
  --header-h: 64px;
  --subheader-h: 45px;
  --top: calc(var(--header-h) + var(--subheader-h));
  --sidebar-w: 288px;
  --content-w: 753px;
  --toc-w: 224px;
  color-scheme: light;
}

/* dark tokens; repeated for the os setting because css vars can't share one block across both selectors */
html[data-theme="dark"] {
  --primary: rgb(52 109 219);
  --primary-hover: rgb(82 134 235);
  --text: rgb(251 255 255);
  --text-muted: rgb(251 255 255 / 0.64);
  --text-subtle: rgb(251 255 255 / 0.64);
  --bg: rgb(29 29 29);
  --header-bg: rgb(29 29 29 / 0.88);
  --tint: rgb(41 44 49);
  --tint-subtle: rgb(33 35 37);
  --border: rgb(67 72 82);
  --border-subtle: rgb(50 58 72);
  --hint-info-bg: rgb(44 44 44);
  --hint-success-bg: rgb(30 48 35);
  --hint-warning-bg: rgb(50 42 35);
  --hint-danger-bg: rgb(54 33 33);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --primary: rgb(52 109 219);
    --primary-hover: rgb(82 134 235);
    --text: rgb(251 255 255);
    --text-muted: rgb(251 255 255 / 0.64);
    --text-subtle: rgb(251 255 255 / 0.64);
    --bg: rgb(29 29 29);
    --header-bg: rgb(29 29 29 / 0.88);
    --tint: rgb(41 44 49);
    --tint-subtle: rgb(33 35 37);
    --border: rgb(67 72 82);
    --border-subtle: rgb(50 58 72);
    --hint-info-bg: rgb(44 44 44);
    --hint-success-bg: rgb(30 48 35);
    --hint-warning-bg: rgb(50 42 35);
    --hint-danger-bg: rgb(54 33 33);
    color-scheme: dark;
  }
}

/* shiki emits light colors inline and dark ones as --shiki-dark vars */
html[data-theme="dark"] .shiki,
html[data-theme="dark"] .shiki span {
  color: var(--shiki-dark) !important;
  background-color: var(--shiki-dark-bg) !important;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .shiki,
  html:not([data-theme="light"]) .shiki span {
    color: var(--shiki-dark) !important;
    background-color: var(--shiki-dark-bg) !important;
  }
}

/* pagefind component ui reads these */
:root {
  --pf-font: var(--font-body);
  --pf-text: var(--text);
  --pf-text-secondary: var(--text-subtle);
  --pf-text-muted: var(--text-muted);
  --pf-background: var(--bg);
  --pf-border: var(--border);
  --pf-border-focus: var(--primary);
  --pf-hover: var(--tint);
  --pf-mark: var(--primary);
  --pf-outline-focus: var(--primary);
  --pf-border-radius: 12px;
  --pf-input-height: 40px;
}

/* base */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0;
  font: 400 16px/26px var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); }
img { max-width: 100%; height: auto; }
button { font: inherit; }
.icon { width: 16px; height: 16px; flex: none; }

/* header */
.header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--border-subtle);
}
.header-main {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  align-items: center;
  gap: 48px;
  height: var(--header-h);
  padding: 0 32px;
}
.logo { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; line-height: 28px; color: var(--text); text-decoration: none; }
.logo img { display: block; width: 32px; height: 32px; }
.search { min-width: 0; max-width: 420px; }
.search pagefind-modal-trigger { width: 100%; }
.header-links { display: flex; align-items: center; gap: 24px; font-size: 14px; line-height: 20px; }
.header-links a { color: var(--text-muted); text-decoration: none; }
.header-links a:hover { color: var(--text); }
.header-links .button-primary {
  padding: 8px 16px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  line-height: 21px;
}
.header-links .button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.header-sub { display: flex; align-items: center; justify-content: space-between; height: var(--subheader-h); padding: 0 32px; }
.spaces { display: flex; gap: 32px; height: 100%; }
.spaces a { display: flex; align-items: center; color: var(--text-muted); text-decoration: none; font-size: 14px; border-bottom: 2px solid transparent; }
.spaces a:hover { color: var(--text); }
.spaces a.active { color: var(--primary); border-bottom-color: var(--primary); }
.menu-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; padding: 4px; }
.menu-toggle .icon { width: 20px; height: 20px; }

.lang-switcher { position: relative; font-size: 14px; }
.lang-switcher summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--text-muted); }
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher ul { position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 4px; list-style: none; min-width: 140px; background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 8px; box-shadow: var(--shadow-sm); }
.lang-switcher a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.lang-switcher a:hover { background: var(--tint); }

/* three columns: sidebar, content, toc */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, var(--content-w)) var(--toc-w);
  column-gap: 48px;
  justify-content: space-between;
  padding: 0 32px;
}

/* sidebar */
.sidebar {
  position: sticky;
  top: var(--top);
  align-self: start;
  height: calc(100vh - var(--top));
  overflow-y: auto;
  padding: 36px 8px 48px 0;
  font-size: 14px;
  line-height: 20px;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  scrollbar-color: transparent transparent;
}
/* like gitbook: thumb only shows while the sidebar is hovered */
.sidebar:hover { scrollbar-color: var(--border) transparent; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 24px; }
.nav-group-title { margin: 0 0 8px; padding: 0 12px 0 0; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text); }
.nav-item { position: relative; }
.nav-item > a { display: block; padding: 6px 30px 6px 0; border-radius: 6px; color: var(--text-muted); text-decoration: none; }
.nav-item > a:hover { color: var(--text); }
.nav-item.active > a { color: var(--primary); font-weight: 600; }
.nav-item li > a { padding-left: 20px; }
.nav-item li.active > a { border-radius: 0 6px 6px 0; box-shadow: inset 1px 0 0 var(--primary); }
.nav-item ul { margin: 8px 0 8px 8px; border-left: 1px solid var(--border-subtle); }
.nav-item li ul { margin-left: 20px; }
.nav-chevron {
  position: absolute;
  top: 4px;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform 0.15s;
}
.nav-chevron .icon { width: 12px; height: 12px; }
.nav-chevron:hover { color: var(--text); }
.nav-item.open > .nav-chevron { transform: rotate(90deg); }
.nav-item.has-children:not(.open) > ul { display: none; }

/* content */
.content { min-width: 0; padding: 36px 0 96px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 8px; padding: 0; list-style: none; font-size: 12px; line-height: 16px; }
.breadcrumbs li + li::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 10px;
  background: var(--text-subtle);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.prose > * + * { margin-top: 20px; }
.prose h1 { margin: 0 0 0; font-size: 36px; line-height: 45px; font-weight: 700; letter-spacing: -0.01em; }
.prose h1 + * { margin-top: 32px; }
.prose .lead { font-size: 18px; line-height: 28px; color: var(--text-subtle); margin-top: 12px; }
.prose h2 { margin: 48px 0 0; padding-top: 0; font-size: 30px; line-height: 36px; font-weight: 600; }
.prose h3 { margin: 36px 0 0; font-size: 24px; line-height: 32px; font-weight: 600; }
.prose h4 { margin: 28px 0 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.prose h5, .prose h6 { margin: 24px 0 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: 16px; }
.prose p { margin: 20px 0 0; }
.prose a { text-decoration: underline; text-decoration-thickness: max(0.07em, 1px); text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.prose a[href^="http"]:not(.content-ref):not(.card-link):not(:has(img))::after {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 3px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M7 17 17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M7 17 17 7'/%3E%3Cpath d='M7 7h10v10'/%3E%3C/svg%3E") center / contain no-repeat;
}
.prose strong { font-weight: 600; }
.prose ul, .prose ol { margin: 20px 0 0; padding-left: 28px; }
.prose li { padding-left: 4px; }
.prose li + li { margin-top: 8px; }
.prose li > ul, .prose li > ol { margin-top: 8px; }
.prose ul > li::marker { color: var(--text-subtle); }
.prose li > p { margin: 0; }
.prose li > p + p { margin-top: 8px; }
.prose ul.contains-task-list { list-style: none; padding-left: 4px; }
.prose hr { margin: 32px 0; border: 0; border-top: 1px solid var(--border-subtle); }
.prose img { border-radius: 6px; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figure > img { display: block; margin: 0 auto; }
.prose figcaption { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--text-subtle); text-align: center; }
.prose blockquote { margin: 20px 0 0; padding: 12px 0 12px 24px; border-left: 2px solid var(--border); color: var(--text-subtle); }
.prose blockquote > :first-child { margin-top: 0; }
.prose :not(pre) > code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--tint);
  box-shadow: inset 0 0 0 1px var(--border);
  font: 0.875em/1.25 var(--font-mono);
  overflow-wrap: anywhere;
}
.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin-top: 20px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 20px;
}
.prose th, .prose td { padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { font-weight: 500; background: var(--tint-subtle); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.prose th:first-child { border-left: 1px solid var(--border-subtle); border-radius: 6px 0 0 6px; }
.prose th:last-child { border-right: 1px solid var(--border-subtle); border-radius: 0 6px 6px 0; }
.prose td { border-top: 1px solid var(--border-subtle); }
.prose tbody tr:first-child td { border-top: 0; }
.prose td + td, .prose th + th { border-left: 1px solid var(--border-subtle); }
.prose details { margin-top: 20px; border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0 16px; }
.prose details > summary { padding: 12px 0; cursor: pointer; font-weight: 500; }
.prose details[open] > summary { border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; }
.prose details > :last-child { margin-bottom: 16px; }
.prose mark { background: color-mix(in srgb, var(--hint-warning-fg) 25%, transparent); color: inherit; }

.not-found p { color: var(--text-subtle); }

/* toc */
.toc {
  position: sticky;
  top: var(--top);
  align-self: start;
  max-height: calc(100vh - var(--top));
  overflow-y: auto;
  padding: 36px 0 32px;
  font-size: 14px;
  line-height: 20px;
}
.toc h2 { display: flex; align-items: center; gap: 4px; margin: 0 0 12px 12px; font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.toc h2 .icon { width: 12px; height: 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 4px 12px; color: var(--text-muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--primary); font-weight: 600; }
.toc-level-1 { margin: 8px 0 2px; }
.toc-level-1:first-child { margin-top: 0; }
.toc-level-2 { margin-left: 12px; border-left: 1px solid var(--border-subtle); }

/* pager */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 64px; }
.pager a { flex: 1; display: flex; flex-direction: column; gap: 2px; max-width: 50%; padding: 12px 16px; border: 1px solid var(--border-subtle); border-radius: 8px; text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--primary); }
.pager a:hover .pager-title { color: var(--primary); }
.pager-label { font-size: 12px; line-height: 16px; color: var(--text-subtle); }
.pager-title { font-size: 16px; line-height: 24px; }
.pager-next { margin-left: auto; text-align: right; }

/* theme toggle, bottom right like the live site */
.theme-toggle { position: fixed; right: 32px; bottom: 16px; z-index: 20; display: flex; gap: 4px; padding: 2px; border-radius: 8px; background: var(--header-bg); }
.theme-toggle button { display: flex; align-items: center; justify-content: center; width: 33px; height: 33px; border: 0; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; }
.theme-toggle button:hover { color: var(--text); }
html:not([data-theme]) .theme-toggle [data-db-theme-value="system"],
html[data-theme="light"] .theme-toggle [data-db-theme-value="light"],
html[data-theme="dark"] .theme-toggle [data-db-theme-value="dark"] { background: var(--tint); color: var(--primary); }

/* blocks */
.hint { display: grid; grid-template-columns: auto 1fr; margin-top: 20px; border-radius: 6px; font-size: 14px; line-height: 20px; }
.hint-icon { padding: 16px 0 16px 16px; }
.hint-icon .icon { width: 17px; height: 17px; margin-top: 1px; }
.hint-body { min-width: 0; padding: 16px 16px 16px 12px; }
.hint-body > * + * { margin-top: 12px; }
.hint-body > :first-child { margin-top: 0; }
.hint-body .code-block, .hint-body .hint { border: 1px solid var(--border-subtle); }
.hint-info { background: var(--hint-info-bg); }
.hint-info .hint-icon { color: var(--hint-info-fg); }
.hint-success { background: var(--hint-success-bg); }
.hint-success .hint-icon { color: var(--hint-success-fg); }
.hint-warning { background: var(--hint-warning-bg); }
.hint-warning .hint-icon { color: var(--hint-warning-fg); }
.hint-danger { background: var(--hint-danger-bg); }
.hint-danger .hint-icon { color: var(--hint-danger-fg); }

.stepper { list-style: none; margin: 20px 0 0; padding: 0; }
.prose .stepper > li { padding-left: 0; margin-top: 0; }
.step { display: flex; gap: 32px; }
.step-marker { position: relative; flex: none; width: 29px; }
.step-number { display: flex; align-items: center; justify-content: center; width: 29px; height: 29px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 16px; line-height: 1; }
.step-marker::after { content: ""; position: absolute; top: 37px; bottom: 8px; left: 14px; width: 1px; background: color-mix(in srgb, var(--primary) 40%, transparent); }
.step-body { flex: 1; min-width: 0; padding-bottom: 24px; }
.step-body > :first-child { margin-top: 0; }
.step-body > h2:first-child, .step-body > h3:first-child, .step-body > h4:first-child { line-height: 29px; }

.tabs { margin-top: 20px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--border-subtle); overflow: hidden; }
.tabs-list { display: flex; overflow-x: auto; background: var(--tint-subtle); box-shadow: inset 0 -1px 0 var(--border-subtle); }
.tabs-list [role="tab"] { flex: none; padding: 10px 16px; border: 0; background: none; color: var(--text-subtle); font-size: 14px; line-height: 20px; font-weight: 500; cursor: pointer; }
.tabs-list [role="tab"]:hover { color: var(--text); }
.tabs-list [role="tab"][aria-selected="true"] { color: var(--text); background: var(--bg); box-shadow: inset 1px 0 0 var(--border-subtle), inset -1px 0 0 var(--border-subtle); }
.tabs-list [role="tab"][aria-selected="true"]:first-child { box-shadow: inset -1px 0 0 var(--border-subtle); }
.tab-panel { padding: 16px 32px 24px; }
.tab-panel > :first-child { margin-top: 0; }

.code-block { margin: 20px 0 0; }
.code-title { margin: 0 0 0; padding: 8px 16px; font-size: 14px; line-height: 20px; text-align: left; color: var(--text); border: 1px solid var(--border-subtle); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--tint-subtle); }
.code-body { position: relative; }
.code-block pre {
  margin: 0;
  padding: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: var(--tint-subtle) !important;
  font: 14px/20px var(--font-mono);
}
.code-title + .code-body pre { border-radius: 0 0 12px 12px; }
.code-block pre code { display: block; min-width: max-content; font: inherit; }
.code-block .line { display: inline-block; min-width: 100%; padding: 0 16px; }
.code-block .line:empty::after { content: " "; }
.code-block.wrap pre code { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.code-block.line-numbers pre code { counter-reset: line; }
.code-block.line-numbers .line::before { counter-increment: line; content: counter(line); display: inline-block; width: 2ch; margin-right: 16px; text-align: right; color: var(--text-subtle); }
.code-block .line.added { background: rgb(0 201 80 / 0.12) !important; box-shadow: inset 2px 0 0 var(--hint-success-fg); }
.code-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.code-copy:hover { color: var(--text); }
.code-copy.copied { color: var(--hint-success-fg); opacity: 1; }
.code-body:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
/* shiki sets an inline bg on pre; tint wins so code blocks match the site in both themes */
.code-block .shiki, html[data-theme="dark"] .code-block .shiki { background-color: var(--tint-subtle) !important; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .code-block .shiki { background-color: var(--tint-subtle) !important; }
}
.code-block .shiki span { background-color: transparent !important; }

.prose .content-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--border-subtle);
  color: var(--text);
  text-decoration: none;
  transition: box-shadow 0.15s;
}
.content-ref:hover { box-shadow: 0 0 0 1px var(--primary); }
.content-ref:hover .content-ref-title { color: var(--primary); }
.content-ref-text { display: flex; flex-direction: column; min-width: 0; }
.content-ref-title { font-size: 16px; line-height: 24px; transition: color 0.15s; }
.content-ref-description { font-size: 14px; line-height: 20px; color: var(--text-subtle); }
.content-ref .icon { color: var(--text-muted); }
.content-ref:hover .icon { color: var(--primary); }

.page-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; margin-top: 20px; }
.prose .page-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--border-subtle);
  color: var(--text);
  font-size: 16px;
  line-height: 24px;
  text-decoration: none;
  transition: box-shadow 0.15s, color 0.15s;
}
.page-card:hover { box-shadow: 0 0 0 1px var(--primary); color: var(--primary); }
.page-card .icon { flex: none; color: var(--text-muted); }
.page-card:hover .icon { color: var(--primary); }
@media (max-width: 639px) { .page-cards { grid-template-columns: 1fr; } }

.embed { margin: 20px 0 0; }
.embed iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
.embed-link a { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-radius: 4px; box-shadow: 0 0 0 1px var(--border-subtle); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.prose .embed-link a::after { display: none; }
.embed-link a:hover { box-shadow: 0 0 0 1px var(--primary); color: var(--primary); }

.columns { display: grid; gap: 32px; margin-top: 20px; }
.column { min-width: 0; }
.column > :first-child { margin-top: 0; }

.cards { display: grid; gap: 16px; margin-top: 20px; }
.cards-small { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cards-large { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--border-subtle), var(--shadow-sm);
  font-size: 14px;
  line-height: 20px;
  transition: box-shadow 0.15s;
}
.card-linked:hover { box-shadow: 0 0 0 1px var(--primary), var(--shadow-sm); }
.card-cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0 !important; }
.card-text { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.card-title { font-weight: 700; color: var(--primary); }
.card-title a, .card-body a { position: relative; z-index: 1; }
.prose .card a::after { display: none; }
.card-body { color: var(--text); }
.card-body:empty { display: none; }
.card-link { position: absolute; inset: 0; }

.file { margin: 20px 0 0; }
.file a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: 4px; box-shadow: 0 0 0 1px var(--border-subtle); color: var(--text); text-decoration: none; }
.file a:hover { box-shadow: 0 0 0 1px var(--primary); color: var(--primary); }
.file figcaption { text-align: left; }

.updates { margin-top: 20px; }
.update { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 32px; padding: 32px 0; border-top: 1px solid var(--border-subtle); }
.update:first-child { border-top: 0; padding-top: 0; }
.update time { position: sticky; top: calc(var(--top) + 16px); align-self: start; font-size: 14px; line-height: 20px; color: var(--text-subtle); }
.update-body > :first-child { margin-top: 0; }

/* narrower desktop: drop the toc first */
@media (max-width: 1279px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, var(--content-w)); justify-content: start; }
  .toc { display: none; }
}

/* mobile: sidebar becomes a drawer */
@media (max-width: 1023px) {
  .header-main { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 16px; padding: 0 16px; }
  .header-sub { padding: 0 16px; }
  .menu-toggle { display: flex; }
  .header-links a:not(.button-primary) { display: none; }
  .search { justify-self: end; width: 100%; }
  .shell { display: block; padding: 0 16px; }
  .sidebar {
    display: none;
    position: fixed;
    inset: var(--top) 0 0 0;
    z-index: 25;
    height: auto;
    padding: 24px 16px 48px;
    background: var(--bg);
  }
  body.menu-open { overflow: hidden; }
  body.menu-open .sidebar { display: block; }
  .theme-toggle { right: 16px; }
}
@media (max-width: 639px) {
  .logo span { display: none; }
  .header-links .button-primary { padding: 6px 12px; }
  .prose h1 { font-size: 30px; line-height: 38px; }
  .prose h2 { font-size: 24px; line-height: 32px; }
  .prose h3 { font-size: 20px; line-height: 28px; }
  .tab-panel { padding: 12px 16px 16px; }
  .update { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .update time { position: static; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}

@media print {
  .header, .sidebar, .toc, .theme-toggle, .pager, .code-copy { display: none !important; }
  .shell { display: block; padding: 0; }
}
