/* ---------------------------------------------------------------------------
   Amalgative Documentation
   Design language inherited from amalgative.com — same tokens, same theme
   toggle, same uppercase micro-typography. Prose is set in sentence case at a
   readable size, because a manual is read, not scanned.
   --------------------------------------------------------------------------- */

:root {
  /* Default: dark theme (matches amalgative.com) */
  --bg-color: #000000;
  --text-color: #ffffff;
  --text-muted: #808080;
  --border-color: #1c1c1c;
  --border-strong: #2a2a2a;
  --surface: #0b0b0b;
  --red: #ff3333;

  --sidebar-width: 268px;
  --toc-width: 200px;
  --gutter: 25px;
  --content-max: 760px;
}

html.white {
  --bg-color: #ffffff;
  --text-color: #000000;
  --text-muted: #666666;
  --border-color: #e6e6e6;
  --border-strong: #d5d5d5;
  --surface: #f7f7f7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Shared micro-typography -------------------------------------------- */

.eyebrow,
.nav-section > span,
.docs-nav .nav-heading,
.toc-heading,
.site-foot,
.page-meta {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

/**
 * The marker dot, from the main site — STATIC HERE.
 *
 * It used to blink on a 0.6s loop. On the front page that is one dot on one
 * screen; in the documentation it sits before the eyebrow of every page and
 * before the Amalgative nav heading, so it blinked continuously beside the text
 * on a page somebody is trying to read. Documentation is read, not glanced at,
 * and a 0.6s pulse in the corner of the eye does not stop being distracting
 * because you have got used to it.
 *
 * The `prefers-reduced-motion` override went with it: there is no motion left
 * to reduce, and a media query guarding an animation that no longer exists is
 * a rule that reads as protection while protecting nothing.
 */
.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--red);
  margin-right: 9px;
  vertical-align: middle;
}

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

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

.docs-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 25px 25px 25px 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}

.docs-sidebar::-webkit-scrollbar { width: 0; }

/* Only ever shown while the mobile drawer is open. */
.nav-close {
  display: none;
  position: absolute;
  top: 22px;
  right: 20px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  cursor: pointer;
}

.brand {
  display: block;
  text-decoration: none;
  color: var(--text-color);
  margin-bottom: 4px;
}

.brand h1 {
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand .brand-sub {
  display: block;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.docs-nav {
  margin-top: 38px;
  flex: 1;
}

.nav-section {
  margin-bottom: 30px;
}

.nav-heading {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.nav-section ul {
  list-style: none;
}

.nav-section li a {
  display: block;
  padding: 3px 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-section li a:hover {
  color: var(--text-color);
}

.nav-section li a.is-current {
  color: var(--text-color);
  font-weight: 700;
}

.sidebar-foot {
  padding-top: 25px;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
}

.site-foot {
  line-height: 1.9;
}

.site-foot a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-foot a:hover { color: var(--text-color); }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0 18px;
  background-color: var(--bg-color);
  transition: background-color 0.35s ease-in-out;
}

.breadcrumb {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--text-color); }

.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.contact-link {
  text-transform: uppercase;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-color);
  font-size: 11px;
  letter-spacing: 0.08em;
  transition: opacity 0.2s ease;
}

.contact-link:hover { opacity: 0.7; }

/* Theme switcher — identical geometry to amalgative.com */
.theme_button {
  position: relative;
  width: 50px;
  height: 20px;
  background-color: #303030;
  border-radius: 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.35s ease-in-out;
  outline: none;
  flex-shrink: 0;
}

.theme_ball {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ffffff;
  top: 4px;
  right: 6px;
  transition: all 0.35s ease-in-out;
}

html.white .theme_button {
  background-color: transparent;
  border-color: #303030;
}

html.white .theme_ball {
  right: 34px;
  background-color: #303030;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  cursor: pointer;
}

/* --- Main column --------------------------------------------------------- */

.docs-main {
  flex: 1;
  min-width: 0;
  padding-left: 25px;
  padding-bottom: 120px;
  border-left: 1px solid var(--border-color);
  transition: border-color 0.35s ease-in-out;
}

.docs-body {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

article.doc {
  flex: 1;
  min-width: 0;
  max-width: var(--content-max);
}

/* --- Page head ----------------------------------------------------------- */

.page-head {
  padding-bottom: 34px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-color);
}

.page-head .eyebrow {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-transform: uppercase;
}

.page-head .summary {
  margin-top: 18px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 62ch;
}

/* --- Prose --------------------------------------------------------------- */

.doc h2 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 64px 0 20px;
  padding-top: 22px;
  border-top: 1px solid var(--border-color);
}

.doc h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }

.doc h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 38px 0 12px;
}

.doc h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 30px 0 10px;
}

.doc .anchor {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  margin-left: 10px;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

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

.doc p {
  margin: 0 0 18px;
  max-width: 72ch;
}

.doc a {
  color: var(--text-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-muted);
  transition: text-decoration-color 0.15s ease;
}

.doc a:hover { text-decoration-color: var(--red); }

.doc strong { font-weight: 700; }

.doc ul, .doc ol {
  margin: 0 0 20px;
  padding-left: 20px;
  max-width: 72ch;
}

.doc li {
  margin-bottom: 8px;
}

.doc li::marker { color: var(--text-muted); }

.doc ul ul, .doc ol ol, .doc ul ol, .doc ol ul {
  margin: 8px 0 0;
}

.doc hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 40px 0;
}

/* Code */

.doc code {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.86em;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}

.doc pre {
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 18px 20px;
  margin: 0 0 24px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
}

.doc pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 26px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.doc table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

.doc th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.doc td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  line-height: 1.55;
}

.doc tr:last-child td { border-bottom: none; }

.doc td code { white-space: nowrap; }

/* Blockquote / callout */

.doc blockquote {
  border-left: 2px solid var(--red);
  background-color: var(--surface);
  padding: 16px 20px;
  margin: 0 0 26px;
  max-width: 72ch;
  font-size: 14px;
  color: var(--text-muted);
}

.doc blockquote p:last-child { margin-bottom: 0; }
.doc blockquote strong { color: var(--text-color); }

/* --- Status: pills, callouts, version chips ------------------------------ */

.pill {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  color: var(--text-muted);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.6;
}

/* Shipped is the only state that reads as ordinary text. Every other state has
   to be visible at a glance, because the whole point is that a reader is never
   misled about what exists. */
.pill.shipped { border-color: var(--text-color); color: var(--text-color); }
.pill.partial { border-color: #c8922e; color: #c8922e; }
.pill.planned { border-color: var(--red); color: var(--red); }
/* Deferred is a DECISION, so it reads calm and settled rather than urgent —
   deliberately not the red `planned` wears. */
.pill.deferred { border-color: var(--text-muted); color: var(--text-muted); }
.pill.not-planned { border-color: var(--border-strong); color: var(--text-muted); }

.version-chip {
  display: inline-block;
  margin-left: 12px;
  padding: 1px 7px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: none;
}

.status-callout {
  border: 1px solid var(--border-color);
  border-left: 2px solid var(--border-strong);
  background-color: var(--surface);
  border-radius: 4px;
  padding: 15px 18px;
  margin: 0 0 26px;
  max-width: 72ch;
}

.status-callout.partial { border-left-color: #c8922e; }
.status-callout.planned { border-left-color: var(--red); }
.status-callout.deferred { border-left-color: var(--text-muted); }
.status-callout.not-planned { border-left-color: var(--text-muted); }

.status-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.status-head strong {
  font-size: 14px;
  font-weight: 700;
}

.status-version {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.status-callout p {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: none;
}

.page-status { margin-bottom: 40px; }
.page-status .status-callout { margin-bottom: 0; }

/* --- Figures (screenshots) ----------------------------------------------- */

figure.shot {
  margin: 0 0 30px;
  max-width: 100%;
}

figure.shot a,
.doc figure.shot a,
.doc figure.shot a:hover {
  display: block;
  text-decoration: none;
  border: none;
}

figure.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--surface);
  transition: border-color 0.2s ease;
}

figure.shot a:hover img { border-color: var(--text-muted); }

figure.shot figcaption::after {
  content: ' ↗ Full size';
  color: var(--text-muted);
  opacity: 0.7;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.04em;
}

figure.shot figcaption {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

figure.shot figcaption strong {
  color: var(--text-color);
  font-weight: 700;
}

/* A numbered tour list beside a screenshot */
ol.callouts {
  list-style: none;
  padding-left: 0;
  counter-reset: callout;
  margin: 0 0 26px;
  max-width: 72ch;
}

ol.callouts > li {
  counter-increment: callout;
  position: relative;
  padding-left: 34px;
  margin-bottom: 14px;
}

ol.callouts > li::before {
  content: counter(callout);
  position: absolute;
  left: 0;
  top: 1px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

/* --- Card grids ---------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background-color: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin: 0 0 34px;
  overflow: hidden;
}

.card,
.doc a.card,
.doc a.card:hover {
  display: block;
  background-color: var(--bg-color);
  padding: 24px 22px 26px;
  text-decoration: none;
  color: var(--text-color);
  transition: background-color 0.2s ease;
}

.card:hover { background-color: var(--surface); }

.card .card-kicker {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card h3 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}

.card p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
  max-width: none;
}

/* --- On this page -------------------------------------------------------- */

.toc {
  width: var(--toc-width);
  min-width: var(--toc-width);
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  scrollbar-width: none;
  padding-bottom: 20px;
}

.toc::-webkit-scrollbar { width: 0; }

.toc-heading { display: block; margin-bottom: 12px; }

.toc ul { list-style: none; }

.toc li a {
  display: block;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.toc li a.is-active {
  color: var(--text-color);
  border-left-color: var(--red);
}

.toc li.lvl-3 a { padding-left: 24px; font-size: 11.5px; }

/* --- Prev / next --------------------------------------------------------- */

.pagination {
  display: flex;
  gap: 1px;
  margin-top: 70px;
  background-color: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.pagination a {
  flex: 1;
  background-color: var(--bg-color);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text-color);
  transition: background-color 0.2s ease;
  min-width: 0;
}

.pagination a:hover { background-color: var(--surface); }

.pagination a.next { text-align: right; }

.pagination .dir {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pagination .label {
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

@media (max-width: 1180px) {
  .toc { display: none; }
}

@media (max-width: 900px) {
  .layout { display: block; padding: 0 20px; }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-width: 0;
    height: 100vh;
    padding: 25px 20px 40px;
    background-color: var(--bg-color);
    border-right: none;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.35s ease-in-out;
  }

  body.nav-open .docs-sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }

  .nav-close { display: block; }

  .docs-main {
    padding-left: 0;
    border-left: none;
  }

  .menu-toggle { display: inline-flex; }

  .page-head h1 { font-size: 30px; }
  .page-head .summary { font-size: 15.5px; }

  .doc h2 { margin-top: 48px; }
}

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

.search {
  position: relative;
  flex: 1;
  max-width: 320px;
  margin-left: auto;
}

.search input {
  width: 100%;
  background-color: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 12.5px;
  padding: 7px 30px 7px 11px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.35s ease-in-out;
  -webkit-appearance: none;
  appearance: none;
}

.search input::placeholder { color: var(--text-muted); }
.search input:focus { border-color: var(--text-muted); }
.search input::-webkit-search-cancel-button { display: none; }

.search-hint {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 0 5px;
  line-height: 15px;
}

.search input:focus + .search-hint { opacity: 0; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(460px, 92vw);
  max-height: 60vh;
  overflow-y: auto;
  background-color: var(--bg-color);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 120;
}

html.white .search-results { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); }

.search-result {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover,
.search-result.is-active { background-color: var(--surface); }

.search-where {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.search-title {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 3px;
}

.search-snippet {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.search-empty {
  padding: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .search { max-width: none; order: 3; flex-basis: 100%; margin: 10px 0 0; }
  .topbar { flex-wrap: wrap; }
  .search-results { left: 0; right: auto; width: 100%; }
}
