/* Tidyfox docs. Adapted from the Atomica Workflow guides. */

@import url("brand.css");

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

img,
svg {
  max-width: 100%;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.skip:focus {
  left: 12px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar);
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-block;
  width: 34px;
  height: 34px;
  flex: none;
}

.brand-mark svg {
  display: block;
  width: 34px;
  height: 34px;
}

.wordmark {
  flex: none;
  width: auto;
  height: 13px;
  color: var(--ink);
}

.brand-sub {
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  letter-spacing: 0;
}

.topbar-spacer {
  flex: 1;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.menu-btn {
  display: none;
}

.theme-toggle .i-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .i-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .i-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .i-moon {
    display: none;
  }
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 24px 16px 48px 20px;
  border-right: 1px solid var(--line);
  overscroll-behavior: contain;
}

.nav-group + .nav-group {
  margin-top: 22px;
}

.nav-title {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-group a {
  display: block;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.45;
}

.nav-group a:hover {
  background: var(--bg-sunken);
  color: var(--ink);
  text-decoration: none;
}

.nav-group a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.content {
  min-width: 0;
  padding: 40px 56px 80px;
}

.article {
  max-width: 780px;
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 40px 20px 40px 8px;
  font-size: 13.5px;
}

.toc-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc li a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  line-height: 1.4;
}

.toc li.toc-h3 a {
  padding-left: 24px;
  font-size: 13px;
}

.toc li a:hover {
  color: var(--ink);
  text-decoration: none;
}

.toc li a.active {
  border-left-color: var(--accent);
  color: var(--accent-ink);
}

.toc:empty,
.toc[hidden] {
  visibility: hidden;
}

.scrim {
  display: none;
}

/* ---------- Typography ---------- */

.crumb,
.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.crumb a {
  color: var(--accent);
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--display);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.035em;
}

h2 {
  margin: 52px 0 12px;
  padding-top: 4px;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

h3 {
  margin: 32px 0 8px;
  font-size: 19.5px;
  font-weight: 550;
}

h4 {
  margin: 22px 0 6px;
  font-size: 16px;
  font-weight: 650;
}

h2 .anchor,
h3 .anchor {
  margin-left: 6px;
  color: var(--faint);
  font-weight: 400;
  opacity: 0;
}

h2:hover .anchor,
h3:hover .anchor {
  opacity: 1;
}

p {
  margin: 12px 0;
}

.lead {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 18.5px;
  line-height: 1.6;
}

ul,
ol {
  margin: 12px 0;
  padding-left: 24px;
}

li {
  margin: 5px 0;
}

li > p {
  margin: 6px 0;
}

strong {
  color: var(--ink);
  font-weight: 620;
}

hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 0.82em;
}

code {
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--inline-code-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.ui {
  color: var(--ink);
  font-weight: 620;
}

dl.terms {
  margin: 16px 0;
}

dl.terms dt {
  color: var(--ink);
  font-weight: 620;
}

dl.terms dd {
  margin: 2px 0 12px;
  color: var(--text);
}

/* ---------- Code blocks ---------- */

.code {
  position: relative;
  margin: 16px 0 20px;
  border: 1px solid var(--code-line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--code-line);
  color: var(--code-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--code-line);
  border-radius: 6px;
  background: transparent;
  color: var(--code-muted);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--code-ink);
  border-color: #3a4560;
}

.copy-btn.copied {
  color: #34d399;
  border-color: #145c43;
}

.copy-btn svg {
  width: 13px;
  height: 13px;
}

pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
  white-space: pre;
}

pre:not(.code pre) {
  margin: 16px 0;
  border-radius: var(--radius);
  background: var(--code-bg);
}

.tok-c {
  color: var(--code-muted);
}

/* ---------- Callouts ---------- */

.callout {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.callout > svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: var(--accent);
}

.callout > div > :first-child {
  margin-top: 0;
}

.callout > div > :last-child {
  margin-bottom: 0;
}

.callout-title {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-weight: 650;
}

.callout.tip {
  border-color: var(--tip-line);
  background: var(--tip-soft);
}

.callout.tip > svg {
  color: var(--tip);
}

.callout.warning {
  border-color: var(--warn-line);
  background: var(--warn-soft);
}

.callout.warning > svg {
  color: var(--warn);
}

/* ---------- Steps ---------- */

ol.steps {
  margin: 20px 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

ol.steps > li {
  position: relative;
  margin: 0;
  padding: 0 0 22px 46px;
  counter-increment: step;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
}

ol.steps > li::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 32px;
  bottom: 4px;
  width: 1px;
  background: var(--line);
}

ol.steps > li:last-child {
  padding-bottom: 4px;
}

ol.steps > li:last-child::after {
  display: none;
}

ol.steps > li > :first-child {
  margin-top: 2px;
}

.step-title {
  display: block;
  color: var(--ink);
  font-weight: 650;
}

/* ---------- Cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0 28px;
}

.cards.two {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}

a.card:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

.card-icon svg {
  width: 18px;
  height: 18px;
}

.card-title {
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 650;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.card-meta {
  margin-top: auto;
  padding-top: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Hero (home) ---------- */

.hero {
  margin: 0 0 36px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1f2329;
  color: #f8f7f4;
}

.hero h1 {
  font-size: clamp(30px, 4.4vw, 42px);
}

.hero .lead {
  max-width: 620px;
  margin-bottom: 20px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.35;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.9;
}

.btn.primary {
  border-color: var(--orange);
  background: var(--orange);
  color: #16191d;
}

/* ---------- Tables ---------- */

.table-wrap {
  margin: 16px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}

th,
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

td code {
  white-space: nowrap;
}

td.wrap code {
  white-space: normal;
}

.req {
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.ok {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- Tabs ---------- */

.tabs {
  margin: 20px 0 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tablist {
  display: flex;
  gap: 4px;
  padding: 6px 6px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tablist [role="tab"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: -1px;
  padding: 9px 14px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tablist [role="tab"] svg {
  width: 15px;
  height: 15px;
}

.tablist [role="tab"]:hover {
  color: var(--ink);
}

.tablist [role="tab"][aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent-ink);
}

.tabpanel {
  padding: 6px 20px 8px;
}

.tabpanel[hidden] {
  display: none;
}

.tabpanel > .code:last-child,
.tabpanel > figure:last-child {
  margin-bottom: 14px;
}

/* ---------- Figures ---------- */

figure {
  margin: 24px 0;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

figure.shot img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  box-shadow: var(--shadow);
}

figure.diagram {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow-x: auto;
}

figure.diagram svg {
  display: block;
  width: 100%;
  min-width: 560px;
  height: auto;
  margin: 0 auto;
  font-family: var(--font);
}

figure.diagram.fit svg {
  min-width: 0;
}

/* SVG diagram classes: colours follow the theme. */
.d-box {
  fill: var(--d-box);
  stroke: var(--d-box-line);
  stroke-width: 1.2;
}

.d-accent {
  fill: var(--d-accent-soft);
  stroke: var(--d-accent);
  stroke-width: 1.4;
}

.d-green {
  fill: var(--d-green-soft);
  stroke: var(--d-green);
  stroke-width: 1.4;
}

.d-amber {
  fill: var(--d-amber-soft);
  stroke: var(--d-amber);
  stroke-width: 1.4;
}

.d-rose {
  fill: var(--d-rose-soft);
  stroke: var(--d-rose);
  stroke-width: 1.4;
}

.d-teal {
  fill: var(--d-teal-soft);
  stroke: var(--d-teal);
  stroke-width: 1.4;
}

.d-zone {
  fill: none;
  stroke: var(--d-box-line);
  stroke-width: 1.2;
  stroke-dasharray: 5 5;
}

.d-title {
  fill: var(--d-text);
  font-size: 14px;
  font-weight: 650;
}

.d-text {
  fill: var(--d-text);
  font-size: 12.5px;
}

.d-muted {
  fill: var(--d-muted);
  font-size: 11.5px;
}

.d-label {
  fill: var(--d-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.d-line {
  fill: none;
  stroke: var(--d-muted);
  stroke-width: 1.4;
}

.d-line.accent {
  stroke: var(--d-accent);
}

.d-line.green {
  stroke: var(--d-green);
}

.d-line.amber {
  stroke: var(--d-amber);
}

.d-line.rose {
  stroke: var(--d-rose);
}

.d-line.dash {
  stroke-dasharray: 5 4;
}

.d-arrow {
  fill: var(--d-muted);
}

.d-arrow.accent {
  fill: var(--d-accent);
}

.d-arrow.green {
  fill: var(--d-green);
}

.d-arrow.amber {
  fill: var(--d-amber);
}

.d-arrow.rose {
  fill: var(--d-rose);
}

.d-fill-accent {
  fill: var(--d-accent);
}

.d-fill-green {
  fill: var(--d-green);
}

.d-fill-amber {
  fill: var(--d-amber);
}

.d-fill-rose {
  fill: var(--d-rose);
}

.d-on {
  fill: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- Pager & footer ---------- */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 64px;
}

.pager a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 600;
}

.pager a:hover {
  border-color: var(--accent-line);
  text-decoration: none;
}

.pager small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.pager .next {
  grid-column: 2;
  text-align: right;
}

.site-foot {
  margin-top: 48px;
  background: #1f2329;
  color: #ccd0d5;
  font-size: 14px;
}

/* ---------- Misc ---------- */

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 12px 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.chips li {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Dark hero band (integrations overview) ---------- */

.hero h1,
.hero strong {
  color: #f8f7f4;
}

.hero .lead {
  color: #ccd0d5;
}

.hero .btn {
  border-color: #f8f7f4;
  background: transparent;
  color: #f8f7f4;
}

.hero .btn.primary {
  border-color: var(--orange);
  background: var(--orange);
  color: #16191d;
}

/* ---------- Top bar additions ---------- */

.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: min(340px, 30vw);
  height: 38px;
  margin-left: 18px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.search-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.search-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.search-btn span {
  flex: 1;
  text-align: left;
}

.search-btn kbd,
.hero-search kbd {
  font-size: 11px;
}

.toplinks {
  display: flex;
  gap: 22px;
  margin-right: 8px;
  font-size: 14px;
  font-weight: 550;
}

.toplinks a {
  color: var(--ink);
}

.icon-btn {
  border-radius: 3px;
}

/* ---------- Sidebar sections ---------- */

.sections {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sections > li {
  margin: 0;
}

.sections > li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
}

.sections > li > a svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.sections > li > a span:first-of-type {
  flex: 1;
}

.sections > li > a:hover {
  background: var(--bg-sunken);
  color: var(--ink);
  text-decoration: none;
}

.sections > li.open > a {
  color: var(--ink);
  font-weight: 650;
}

.sections > li.open > a svg {
  color: var(--orange);
}

.sections .nav-group {
  margin: 4px 0 10px 18px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.sections .nav-group + .nav-group {
  margin-top: 10px;
}

.nav-sub {
  margin: 8px 0 2px;
  padding: 0 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.nav-group a {
  font-size: 14px;
}

.nav-group a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.soon-chip {
  flex: none;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pins {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.pins ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pins li {
  display: flex;
  align-items: center;
  margin: 0;
}

.pins li a {
  flex: 1;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
}

.pins li a:hover {
  background: var(--bg-sunken);
  text-decoration: none;
}

.unpin {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--faint);
  font-size: 16px;
  cursor: pointer;
}

.unpin:hover {
  color: var(--ink);
  background: var(--bg-sunken);
}

/* ---------- Page title row with pin ---------- */

.title-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.title-row h1 {
  flex: 1;
}

.pin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-top: 8px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.pin-btn svg {
  width: 15px;
  height: 15px;
}

.pin-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.pin-btn[aria-pressed="true"] {
  border-color: var(--orange);
  color: var(--accent);
}

.pin-btn[aria-pressed="true"] svg {
  fill: var(--orange);
  stroke: var(--orange);
}

.pin-note {
  margin: -4px 0 16px;
  color: var(--warn);
  font-size: 13.5px;
}

/* ---------- Term links (to detail pages) ---------- */

a.term {
  color: inherit;
  text-decoration: underline dotted var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

a.term:hover {
  color: var(--accent);
  text-decoration-style: solid;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Home ---------- */

body.home .layout,
body.soon-page .layout {
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

body.home .toc,
body.soon-page .toc {
  display: none;
}

body.home .article {
  max-width: 1040px;
}

.home-hero {
  margin: 0 0 40px;
  padding: 48px 44px 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1f2329;
  color: #f8f7f4;
}

.home-hero .eyebrow {
  color: #ccd0d5;
}

.home-hero h1 {
  margin-bottom: 12px;
  color: #f8f7f4;
  font-size: clamp(36px, 5vw, 52px);
}

.home-hero .lead {
  max-width: 560px;
  color: #ccd0d5;
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 620px;
  height: 54px;
  padding: 0 16px;
  border: 0;
  border-radius: 3px;
  background: #f8f7f4;
  color: #59616b;
  font: inherit;
  font-size: 16px;
  cursor: text;
}

.hero-search svg {
  width: 20px;
  height: 20px;
  color: #1f2329;
}

.hero-search span {
  flex: 1;
  text-align: left;
}

.hero-search kbd {
  border-color: #d3d6db;
  background: #eeedea;
  color: #59616b;
}

.hero-search:hover {
  box-shadow: 0 0 0 3px var(--orange);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

a.section-card:hover,
.section-card:has(.section-card-head:hover) {
  border-color: var(--ink);
  text-decoration: none;
}

.section-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.section-card-head:hover {
  text-decoration: none;
}

.section-card .card-icon {
  margin: 0;
}

.section-card .card-title {
  flex: 1;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.section-card ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.section-card li {
  margin: 4px 0;
}

.section-card .card-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.section-card .card-meta svg {
  width: 15px;
  height: 15px;
}

.soon-thumb {
  width: 34px;
  height: 34px;
  padding: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.soon-card {
  background: var(--bg-soft);
}

.soon-card .soon-chip {
  align-self: flex-start;
  margin-top: auto;
}

.resources-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 14.5px;
}

.resources-strip > span:nth-child(2) {
  flex: 1;
}

.resources-strip strong {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 550;
}

.resources-strip > svg {
  width: 20px;
  height: 20px;
  color: var(--ink);
}

.resources-strip:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.home-pins h2 {
  margin-top: 0;
}

.pin-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 32px;
  padding: 0;
  list-style: none;
}

.pin-cards li {
  margin: 0;
}

.pin-cards a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
}

.pin-cards a::before {
  content: "\2605";
  color: var(--orange);
}

.pin-cards a:hover {
  border-color: var(--ink);
  text-decoration: none;
}

/* ---------- Coming soon ---------- */

.soon {
  padding: 8px 0 4px;
}

.soon-art {
  display: grid;
  place-items: center;
  width: 188px;
  height: 188px;
  margin: 0 0 24px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.soon-art img {
  width: 132px;
  height: 132px;
}

.soon .eyebrow {
  color: var(--accent);
}

ul.check-list {
  padding: 0;
  list-style: none;
}

ul.check-list li {
  position: relative;
  padding-left: 28px;
}

ul.check-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 12px;
  height: 7px;
  border-bottom: 2px solid var(--orange);
  border-left: 2px solid var(--orange);
  transform: rotate(-45deg);
}

/* ---------- Resources ---------- */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 24px 0 12px;
}

.resource {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.resource:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.resource .card-title {
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 650;
}

.resource code {
  align-self: flex-start;
  margin-top: auto;
}

/* ---------- Search ---------- */

.search-dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 80px));
  margin: 64px auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-dialog[open] {
  display: flex;
  flex-direction: column;
}

.search-dialog::backdrop {
  background: rgb(22 25 29 / 55%);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.search-field svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex: none;
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 58px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}

.search-field kbd {
  font-size: 11px;
}

.search-results {
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
}

.search-results li {
  margin: 0;
}

.search-results .group {
  margin: 10px 8px 4px;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.search-results a:hover,
.search-results a[aria-selected="true"] {
  background: var(--accent-soft);
  text-decoration: none;
}

.search-results .r-title {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.search-results .r-snip {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.search-results mark {
  padding: 0 1px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--orange) 28%, transparent);
  color: inherit;
}

.search-empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.search-foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
}

/* ---------- Footer band ---------- */

.foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 32px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px;
}

.site-foot .brand,
.site-foot .wordmark {
  color: #f8f7f4;
}

.site-foot .brand-sub {
  border-color: #3d444d;
  color: #ccd0d5;
}

.site-foot .brand-mark {
  --logo-tile: #f8f7f4;
  --logo-mark: #1f2329;
  --bg: #1f2329;
}

.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  flex: 1;
}

.site-foot nav a {
  color: #f8f7f4;
}

.site-foot p {
  margin: 0;
  color: #8f97a1;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .toplinks {
    display: none;
  }
}

@media (max-width: 860px) {
  .search-btn {
    width: 38px;
    margin-left: auto;
    padding: 0;
    justify-content: center;
  }

  .search-btn span,
  .search-btn kbd,
  .brand-sub,
  .topbar .wordmark {
    display: none;
  }

  .topbar-spacer {
    display: none;
  }

  body.home .layout,
  body.soon-page .layout {
    display: block;
  }

  .home-hero {
    padding: 32px 20px;
  }

  .hero-search kbd {
    display: none;
  }

  .title-row {
    flex-direction: column;
    gap: 0;
  }

  .pin-btn {
    margin: 0 0 14px;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  .content {
    padding: 36px 40px 72px;
  }
}

@media (max-width: 860px) {
  .menu-btn {
    display: inline-grid;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar);
    left: 0;
    bottom: 0;
    z-index: 35;
    width: min(300px, 86vw);
    height: auto;
    background: var(--bg);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar {
    transform: none;
  }

  body.nav-open .scrim {
    display: block;
    position: fixed;
    inset: var(--topbar) 0 0 0;
    z-index: 30;
    background: rgb(8 12 20 / 45%);
  }

  .content {
    padding: 28px 16px 64px;
  }

  .hero {
    padding: 24px 20px;
  }

  .tabpanel {
    padding: 4px 14px 6px;
  }

  h2 {
    margin-top: 44px;
    font-size: 22px;
  }

  .lead {
    font-size: 17px;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager .next {
    grid-column: 1;
  }

  figure.diagram {
    padding: 12px;
  }

  .kv {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  pre {
    font-size: 12.5px;
  }
}

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

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .copy-btn {
    display: none !important;
  }

  .layout {
    display: block;
  }
}
